﻿using Abp.Application.Services;
using Abp.Domain.Repositories;
using Abp.UI;
using Camc.Quality.Quality;
using System;
using System.Net;
using System.Threading.Tasks;
using Camc.Quality.Dto.ProcessesEntityDto;
using System.Collections.Generic;
using Newtonsoft.Json;
using Camc.Quality.QualityAnalysis.RTechniqueEntity;
using Camc.Quality.Quality.TransformHtml;
using Camc.Quality.Dto.TableOutDto;
using Camc.Quality.Dto.TableReturnDto;
using Camc.Quality.QualityAnalysis.RFormEntity;
using Camc.Quality.QualityAnalysis.RFormClass;
using Camc.Quality.ITech;
using System.Reflection;
using Camc.Quality.Bop;
using Camc.Quality.Bop.IbopInterface;
using Camc.Quality.Dto.TableReturnDto.Technique;
using Microsoft.AspNetCore.Http;
using System.IO;
using ICSharpCode.SharpZipLib.Zip;  //C:\Users\tj_dongzhy\.nuget\packages\sharpziplib\1.3.2
using System.Linq;
using Camc.Quality.QualityAnalysis.RFormBase;
using Camc.Quality.OperationHistory;
using Camc.Quality.Authorization.Users;
using Camc.Quality.Inspection;
using Camc.Quality.IOperationHistory;
using Abp.Domain.Uow;
using Camc.Quality.ProductionPlan;
using Abp.Authorization.Users;
using Abp.Organizations;
using Abp.EntityFrameworkCore.Repositories;
using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Authorization;
using System.Collections.ObjectModel;
using Camc.Quality.Dto.QualityPlatformDto;
using System.Data.SqlClient;
using Microsoft.EntityFrameworkCore;

namespace Camc.Quality.Quality
{
    public class TechProcessAppService : QualityAppServiceBase, ITechProcess
    {
        public TechProcessAppService()
        {

        }

        QualityApplicationModule qualityApplicationModule = new QualityApplicationModule();
        private readonly IRepository<BopNode, Guid> _bopNodeRepository;
        private readonly IRepository<BopDesc, Guid> _bopDescRepository;
        private readonly IRepository<ProductionScheduler, Guid> _productionSchedulerRepository;
        private readonly IRepository<InspectionSeverityDesc, Guid> _inspectionSeverityDescRepository;
        private readonly IRepository<InspectionTypeDesc, Guid> _inspectionTypeDescRepository;
        private readonly IRepository<InspectionItemInfo, Guid> _inspectionItemInfoRepository;
        private readonly IRepository<InspectionStandardDesc, Guid> _inspectionStandardDescRepository;
        private readonly IOperationHistoryAppService _iOperationHistoryAppService;
        private readonly IRepository<User, long> _userRepository;
        private readonly IRepository<OperationLog, Guid> _operationLogRepository;
        private readonly IUnitOfWorkManager _unitOfWorkManager;
        private readonly IRepository<UploadPicture, Guid> _uploadPictureRepository;
        private readonly IRepository<JobWorker, Guid> _jobWorkerRepository;
        private readonly IRepository<UserOrganizationUnit, long> _userOrganizationUnitRepository;
        private readonly IRepository<OrganizationUnit, long> _organizationUnitRepository;
        private ProcessManage _processManage { get; set; }
        public TechDocClient techDocClient { get; set; }
        private readonly IRepository<OperationLog, Guid> _operationHistoryRepository;
        private readonly IBopNodeAppService _ibopNodeAppService;
        private readonly IRepository<RTableBase, Guid> _rTableBaseEntity;
        private readonly IRepository<RTechniqueEntity, Guid> _rTechniqueEntityRepository;
        private readonly IRepository<RLoadPieceEntity, Guid> _loadPieceRepository;//装入件明细
        private readonly IRepository<RVideoEntity, Guid> _videoEntityRepository;//视频
        private readonly IRepository<RMakeResourcesEntity, Guid> _makeResourcesEntityRepository;//制造资源
        private readonly IRepository<ProcessesEntity, Guid> _processesRepository;
        private readonly IRepository<WorkStepEntity, Guid> _workStepEntityRepository;
        private readonly IRepository<RTechniqueEntity, Guid> _rTechniqueRepository;
        private readonly IRepository<RProcessesEntity, Guid> _RprocessesRepository;
        private readonly IRepository<RWorkStepEntity, Guid> _RWorkStepRepository;
        private readonly IRepository<R具有证明书的主要零件记录表, Guid> _mainPartsRepository;
        private readonly IRepository<R舱口盖开闭记录表, Guid> _hatchRepository;
        private readonly IRepository<R通用力矩复校记录表, Guid> _momentRecordRepository;
        private readonly IRepository<R力矩记录表, Guid> _momentRepository;
        private readonly IRepository<R通用多媒体记录表, Guid> _multiMediaRepository;
        private readonly IRepository<R通用总装数据记录表, Guid> _totalDataRepository;
        private readonly IRepository<R胶液配比情况记录表, Guid> _liquidRatioRepository;
        private readonly IRepository<R质量控制记录表, Guid> _controlrecordRepository;
        private readonly IRepository<R进箱舱登记表, Guid> _enterRegisterRepository;
        private readonly IRepository<R通用记录表, Guid> _generalRecordsRepository;
        private readonly IRepository<R电缆插头防水防热记录表, Guid> _cableRepository;
        private readonly IRepository<R电连接器插接记录表, Guid> _connectorRepository;
        private readonly IRepository<R波纹管变形记录表, Guid> _rippleRepository;

        private readonly IRepository<R箭地接口保护件检查记录表, Guid> _arrowInterfaceProtectCheckRepository;
        private readonly IRepository<R绝热去除记录表, Guid> _adiabaticRemovalRepository;
        private readonly IRepository<R箭体称重时多装少装产品记录表, Guid> _arrowScalageProductsRepository;
        private readonly IRepository<R箭体结构防水记录表, Guid> _arrowStructureWaterproofRepository;
        private readonly IRepository<R电缆高度测量记录表, Guid> _cableHeightRepository;
        private readonly IRepository<R管路上箭前吹除记录表, Guid> _blowPipeArrowRepository;
        private readonly IRepository<R电缆接收检查记录表, Guid> _cableReceivingInspectionRepository;
        private readonly IRepository<R自动关闭口盖检查记录表, Guid> _automaticShutoffRepository;
        private readonly IRepository<R总装零件称重记录表, Guid> _assemnleweighingRepository;
        private readonly IRepository<R箭体称重记录表, Guid> _arrowWeightRepository;
        private readonly IRepository<R连续拧紧环节力矩复校记录表, Guid> _calibrationContinuousTorqueRepository;
        private readonly IRepository<R导管检查记录表, Guid> _catheterizationRepository;
        private readonly IRepository<R整流罩安装后检查记录表, Guid> _checkFairingAfterInstallationRepository;
        private readonly IRepository<R阀门安装状态确认表, Guid> _confirmationStatusRepository;
        private readonly IRepository<R传感器变换器对应关系确认记录表, Guid> _correspondingRelationshipRepository;
        private readonly IRepository<R密封插头压接多媒体记录表, Guid> _crimpingSealedPlugRepository;
        private readonly IRepository<R气瓶组充放气速率记录表, Guid> _cylinderGroupRepository;
        private readonly IRepository<R气瓶压力测试记录表, Guid> _cylinderPressureTestRepository;
        private readonly IRepository<R干燥剂检查记录表, Guid> _desiccantInspectionRepository;
        private readonly IRepository<R设计签署总装数据记录表, Guid> _designGeneralAssembleRepository;
        private readonly IRepository<R爆索尺寸测量记录表, Guid> _detonatingCableSizeRepository;
        private readonly IRepository<R分解重装记录表, Guid> _disassemblyReassemblyRepository;
        private readonly IRepository<R对接面形位记录表, Guid> _dockSurfaceMorphemeRepository;
        private readonly IRepository<R低频压接实验测量记录表, Guid> _experimentalCrimpingRepository;
        private readonly IRepository<R未按要求施加力矩及未打保险防松记录表, Guid> _failureAequiredLoosInsuranceRepository;
        private readonly IRepository<R整流罩锉修记录表, Guid> _filingFileRepairRepository;
        private readonly IRepository<R除了打保险防松外的总装直属件记录表, Guid> _finalAssemblyPartsRepository;
        private readonly IRepository<R惯组安装记录表一, Guid> _firstIMUInstallationRepository;
        private readonly IRepository<R强制检验点记录表, Guid> _forcedCheckpointRepository;
        private readonly IRepository<R飞行质量质心皮重及参数记录表, Guid> _flightMassCentroidTareWeightRepository;
        private readonly IRepository<R气封管流量测试记录表, Guid> _gasPipeTestRepository;
        private readonly IRepository<R气封流量测试记录表, Guid> _gasSealFlowTestRepository;
        private readonly IRepository<R总装耗材称重记录表, Guid> _generalWeighingRepository;
        private readonly IRepository<R舱口盖开闭测试记录表, Guid> _hatchOpenShutTestRepository;
        private readonly IRepository<R管路活门气密点检查记录表氦质谱法, Guid> _heliumMassSpectrometryRepository;
        private readonly IRepository<R电缆剥线试验记录表高频, Guid> _highFrequencyCableStrippingRepository;
        private readonly IRepository<R高频压接点电阻及抗电强度检查记录表, Guid> _highFrequencyVoltageRepository;
        private readonly IRepository<R通用检查记录表, Guid> _inspectionRecordRepository;
        private readonly IRepository<R安装距离记录表, Guid> _installationDistanceRepository;
        private readonly IRepository<R单机安装位置记录表, Guid> _installationLocationRepository;
        private readonly IRepository<R管路垫块安装情况记录表, Guid> _installationPipeCushionRepository;
        private readonly IRepository<R产品安装数量记录表, Guid> _installationQuantityRepository;
        private readonly IRepository<R仪器接收检查记录表, Guid> _instrumentCheckRepository;
        private readonly IRepository<R配合七零三绝热记录表, Guid> _insulation703Repository;
        private readonly IRepository<R接口检查记录表, Guid> _interfaceCheckRepository;
        private readonly IRepository<R岗位分工表, Guid> _jobDivisionRepository;
        private readonly IRepository<R随大部段交付产品明细表, Guid> _largePartsDeliveryRepository;
        private readonly IRepository<R大部段称重记录表, Guid> _largeSectionWeightRepository;
        private readonly IRepository<R飞行质量质心设备调平数据记录表, Guid> _levelingDataFlightRepository;
        private readonly IRepository<R液位传感器尺寸协调记录表, Guid> _liquidLevelSensorRepository;
        private readonly IRepository<R载荷支架组合体形位数据记录表, Guid> _loadBracketRepository;
        private readonly IRepository<R压接实验测量记录表低频, Guid> _lowCrimpingExperimentRepository;
        private readonly IRepository<R电缆剥线试验记录表低频, Guid> _lowFrequencyCableStrippingRepository;
        private readonly IRepository<R小导管卡箍间距测量表, Guid> _measurementSpacingConduitRepository;
        private readonly IRepository<R插头状态检查表, Guid> _plugStatusRepository;
        private readonly IRepository<R问题记录表, Guid> _problemRecordRepository;
        private readonly IRepository<R产品接地状态检查记录表, Guid> _productGroundingStatusRepository;
        private readonly IRepository<R产品安装确认表, Guid> _productInstallationConfirmationRepository;
        private readonly IRepository<R通用保护件检查记录表, Guid> _protectivePartsRepository;
        private readonly IRepository<R象限标识检查记录表, Guid> _quadrantCheckRepository;
        private readonly IRepository<R惯组安装记录表二, Guid> _secondIMUInstallationRepository;
        private readonly IRepository<R传感器安装测试记录情况统计记录表, Guid> _sensorInstallationRepository;
        private readonly IRepository<R管路活门气密点检查记录表皂泡法, Guid> _soapBubbleRepository;
        private readonly IRepository<R系统保压记录表, Guid> _systemPressureMaintainingRepository;
        private readonly IRepository<R状态检查表, Guid> _statusCheckRepository;
        private readonly IRepository<R高频压接点抗拉强度检查记录表, Guid> _tensileStrengthHighRepository;
        private readonly IRepository<R电磁阀尾罩检查表, Guid> _tailCoverSolenoidRepository;
        private readonly IRepository<R横向质心测量记录表, Guid> _transverseCentroidRepository;
        private readonly IRepository<R阀门气瓶过滤器流量计输送管金属软管等检查记录表, Guid> _valvesGasInspectionRepository;
        private readonly IRepository<R阀门测试记录表一, Guid> _valveTestRepository;
        private readonly IRepository<R阀门测试记录表二, Guid> _valveTestSecRepository;
        private readonly IRepository<R阀门使用次数记录表, Guid> _valveUsageTimesRepository;
        private readonly IRepository<R整流罩星箭分离弹簧压缩数据记录表, Guid> _releaseSpringCompressionRepository;
        private readonly IRepository<R搭接线安装部位防水记录表, Guid> _waterproofInstallationLapdRepository;
        private readonly IRepository<R通用接收检查记录表, Guid> _receivingInspectionRecordRepository;
        private readonly IRepository<R电连接器插接多媒体记录表, Guid> _dianlianjieqichajieduomeitijilubiaoRepository;
        private readonly IRepository<R仪器安装电缆余量多媒体记录表, Guid> _yiqianzhuangdianlanyuliangduomeitijilubiaoRepository;
        private readonly IRepository<R仪器安装分离钢索多媒体记录表, Guid> _yiqianzhuangfenligangsuoduomeitijilubiaoRepository;
        private readonly IRepository<R仪器安装分离力测试多媒体记录表, Guid> _yiqianzhuangfenliceshiduomeitijilubiaoRepository;
        private readonly IRepository<R仪器安装力矩记录表, Guid> _yiqianzhuanglijvjilubiaoRepository;
        private readonly IRepository<R仪器插座安装多媒体记录表, Guid> _yiqichazuoanzhuangduomeitijilubiaoRepository;

        private readonly IRepository<EditFileProcess, Guid> _editFileProcessRepository;
        private readonly IRepository<BackOperationDto, Guid> _backOperationDtoProcessRepository;
        private readonly IRepository<EditFileProcessInfo, Guid> _editFileProcessInfoRepository;
        private readonly IRepository<EditFileStepInfo, Guid> _editFileStepInfoRepository;
        private readonly IRepository<EditFileTableInfo, Guid> _editFileTableInfoRepository;
        private readonly IRepository<EditFileRowInfo, Guid> _editFileRowInfoRepository;
        private readonly IRepository<EditFileTableStructInfo, Guid> _editFileTableStructInfoRepository;
        private readonly IRepository<EditFileTableDataInfo, Guid> _editFileTableDataInfoRepository;


        private readonly IRepository<ClearSignatureRecord, Guid> _clearSignatureRecordRepository;
        private readonly IRepository<ClearSignatureRowData, Guid> _clearSignatureRowDataRepository;
        private readonly IRepository<ClearSignatureDataStruce, Guid> _clearSignatureDataStruceRepository;


        public TechProcessAppService(
         IRepository<User, long> userRepository,
        IRepository<OrganizationUnit, long> organizationUnitRepository,
                                    IRepository<UserOrganizationUnit, long> userOrganizationUnitRepository,
                                    IRepository<JobWorker, Guid> jobWorkerRepository,
                                    IRepository<BopNode, Guid> bopNodeRepository,
                                    IRepository<BopDesc, Guid> bopDescRepository,
                                    IRepository<WorkStepEntity, Guid> workStepEntityRepository,
                                    IRepository<ProductionScheduler, Guid> productionSchedulerRepository,
                                    IRepository<InspectionSeverityDesc, Guid> inspectionSeverityDescRepository,
                                    IRepository<InspectionTypeDesc, Guid> inspectionTypeDescRepository,
                                    IRepository<InspectionItemInfo, Guid> inspectionItemInfoRepository,
                                    IRepository<InspectionStandardDesc, Guid> inspectionStandardDescRepository,
                                    IOperationHistoryAppService iOperationHistoryAppService,
                                    IRepository<OperationLog, Guid> operationLogRepository,
                                    IUnitOfWorkManager unitOfWorkManager,
                                    IRepository<OperationLog, Guid> operationHistoryRepository,
                                    IRepository<UploadPicture, Guid> uploadPictureRepository,
                                    IRepository<RTableBase, Guid> rTableBaseEntity,
                                    IBopNodeAppService ibopNodeAppService,
                                    IRepository<ProcessesEntity, Guid> processesRepository,
                                    ProcessManage processManage,
                                    IRepository<RMakeResourcesEntity, Guid> makeResourcesEntityRepository,
                                    IRepository<RVideoEntity, Guid> videoEntityRepository,
                                    IRepository<RLoadPieceEntity, Guid> loadPieceRepository,
                                    IRepository<RTechniqueEntity, Guid> rTechniqueRepository,
                                    IRepository<RProcessesEntity, Guid> RprocessesRepository,
                                    IRepository<RWorkStepEntity, Guid> RWorkStepRepository,
                                    IRepository<R具有证明书的主要零件记录表, Guid> mainPartsRepository,
                                    IRepository<R舱口盖开闭记录表, Guid> hatchRepository,
                                    IRepository<R通用力矩复校记录表, Guid> momentRecordRepository,
                                    IRepository<R力矩记录表, Guid> momentRepository,
                                    IRepository<R通用多媒体记录表, Guid> multiMediaRepository,
                                    IRepository<R通用总装数据记录表, Guid> totalDataRepository,
                                    IRepository<R胶液配比情况记录表, Guid> liquidRatioRepository,
                                    IRepository<R质量控制记录表, Guid> controlrecordRepository,
                                    IRepository<R进箱舱登记表, Guid> enterRegisterRepository,
                                    IRepository<R通用记录表, Guid> generalRecordsRepository,
                                    IRepository<RTechniqueEntity, Guid> rTechniqueEntityRepository,
                                    IRepository<R电缆插头防水防热记录表, Guid> cableRepository,
                                    IRepository<R电连接器插接记录表, Guid> connectorRepository,
                                    IRepository<R波纹管变形记录表, Guid> rippleRepository,
                                    IRepository<R箭地接口保护件检查记录表, Guid> arrowInterfaceProtectCheckRepository,
                                    IRepository<R绝热去除记录表, Guid> adiabaticRemovalRepository,
                                    IRepository<R箭体称重时多装少装产品记录表, Guid> arrowScalageProductsRepository,
                                    IRepository<R箭体结构防水记录表, Guid> arrowStructureWaterproofRepository,
                                    IRepository<R电缆高度测量记录表, Guid> cableHeightRepository,
                                    IRepository<R管路上箭前吹除记录表, Guid> blowPipeArrowRepository,
                                    IRepository<R电缆接收检查记录表, Guid> cableReceivingInspectionRepository,
                                    IRepository<R自动关闭口盖检查记录表, Guid> automaticShutoffRepository,
                                    IRepository<R总装零件称重记录表, Guid> assemnleweighingRepository,
                                    IRepository<R箭体称重记录表, Guid> arrowWeightRepository,
                                    IRepository<R连续拧紧环节力矩复校记录表, Guid> calibrationContinuousTorqueRepository,
                                    IRepository<R导管检查记录表, Guid> catheterizationRepository,
                                    IRepository<R整流罩安装后检查记录表, Guid> checkFairingAfterInstallationRepository,
                                    IRepository<R阀门安装状态确认表, Guid> confirmationStatusRepository,
                                    IRepository<R传感器变换器对应关系确认记录表, Guid> correspondingRelationshipRepository,
                                    IRepository<R密封插头压接多媒体记录表, Guid> crimpingSealedPlugRepository,
                                    IRepository<R气瓶组充放气速率记录表, Guid> cylinderGroupRepository,
                                    IRepository<R气瓶压力测试记录表, Guid> cylinderPressureTestRepository,
                                    IRepository<R干燥剂检查记录表, Guid> desiccantInspectionRepository,
                                    IRepository<R设计签署总装数据记录表, Guid> designGeneralAssembleRepository,
                                    IRepository<R爆索尺寸测量记录表, Guid> detonatingCableSizeRepository,
                                    IRepository<R分解重装记录表, Guid> disassemblyReassemblyRepository,
                                    IRepository<R对接面形位记录表, Guid> dockSurfaceMorphemeRepository,
                                    IRepository<R低频压接实验测量记录表, Guid> experimentalCrimpingRepository,
                                    IRepository<R未按要求施加力矩及未打保险防松记录表, Guid> failureAequiredLoosInsuranceRepository,
                                    IRepository<R整流罩锉修记录表, Guid> filingFileRepairRepository,
                                    IRepository<R除了打保险防松外的总装直属件记录表, Guid> finalAssemblyPartsRepository,
                                    IRepository<R惯组安装记录表一, Guid> firstIMUInstallationRepository,
                                    IRepository<R强制检验点记录表, Guid> forcedCheckpointRepository,
                                    IRepository<R飞行质量质心皮重及参数记录表, Guid> flightMassCentroidTareWeightRepository,
                                    IRepository<R气封管流量测试记录表, Guid> gasPipeTestRepository,
                                    IRepository<R气封流量测试记录表, Guid> gasSealFlowTestRepository,
                                    IRepository<R总装耗材称重记录表, Guid> generalWeighingRepository,
                                    IRepository<R舱口盖开闭测试记录表, Guid> hatchOpenShutTestRepository,
                                    IRepository<R管路活门气密点检查记录表氦质谱法, Guid> heliumMassSpectrometryRepository,
                                    IRepository<R电缆剥线试验记录表高频, Guid> highFrequencyCableStrippingRepository,
                                    IRepository<R高频压接点电阻及抗电强度检查记录表, Guid> highFrequencyVoltageRepository,
                                    IRepository<R通用检查记录表, Guid> inspectionRecordRepository,
                                    IRepository<R安装距离记录表, Guid> installationDistanceRepository,
                                    IRepository<R单机安装位置记录表, Guid> installationLocationRepository,
                                    IRepository<R管路垫块安装情况记录表, Guid> installationPipeCushionRepository,
                                    IRepository<R产品安装数量记录表, Guid> installationQuantityRepository,
                                    IRepository<R仪器接收检查记录表, Guid> instrumentCheckRepository,
                                    IRepository<R配合七零三绝热记录表, Guid> insulation703Repository,
                                    IRepository<R接口检查记录表, Guid> interfaceCheckRepository,
                                    IRepository<R岗位分工表, Guid> jobDivisionRepository,
                                    IRepository<R随大部段交付产品明细表, Guid> largePartsDeliveryRepository,
                                    IRepository<R大部段称重记录表, Guid> largeSectionWeightRepository,
                                    IRepository<R飞行质量质心设备调平数据记录表, Guid> levelingDataFlightRepository,
                                    IRepository<R液位传感器尺寸协调记录表, Guid> liquidLevelSensorRepository,
                                    IRepository<R载荷支架组合体形位数据记录表, Guid> loadBracketRepository,
                                    IRepository<R压接实验测量记录表低频, Guid> lowCrimpingExperimentRepository,
                                    IRepository<R电缆剥线试验记录表低频, Guid> lowFrequencyCableStrippingRepository,
                                    IRepository<R小导管卡箍间距测量表, Guid> measurementSpacingConduitRepository,
                                    IRepository<R插头状态检查表, Guid> plugStatusRepository,
                                    IRepository<R问题记录表, Guid> problemRecordRepository,
                                    IRepository<R产品接地状态检查记录表, Guid> productGroundingStatusRepository,
                                    IRepository<R产品安装确认表, Guid> productInstallationConfirmationRepository,
                                    IRepository<R通用保护件检查记录表, Guid> protectivePartsRepository,
                                    IRepository<R象限标识检查记录表, Guid> quadrantCheckRepository,
                                    IRepository<R惯组安装记录表二, Guid> secondIMUInstallationRepository,
                                    IRepository<R传感器安装测试记录情况统计记录表, Guid> sensorInstallationRepository,
                                    IRepository<R管路活门气密点检查记录表皂泡法, Guid> soapBubbleRepository,
                                    IRepository<R系统保压记录表, Guid> systemPressureMaintainingRepository,
                                    IRepository<R状态检查表, Guid> statusCheckRepository,
                                    IRepository<R高频压接点抗拉强度检查记录表, Guid> tensileStrengthHighRepository,
                                    IRepository<R电磁阀尾罩检查表, Guid> tailCoverSolenoidRepository,
                                    IRepository<R横向质心测量记录表, Guid> transverseCentroidRepository,
                                    IRepository<R阀门气瓶过滤器流量计输送管金属软管等检查记录表, Guid> valvesGasInspectionRepository,
                                    IRepository<R阀门测试记录表一, Guid> valveTestRepository,
                                    IRepository<R阀门测试记录表二, Guid> valveTestSecRepository,
                                    IRepository<R阀门使用次数记录表, Guid> valveUsageTimesRepository,
                                    IRepository<R整流罩星箭分离弹簧压缩数据记录表, Guid> releaseSpringCompressionRepository,
                                    IRepository<R搭接线安装部位防水记录表, Guid> waterproofInstallationLapdRepository,
                                    IRepository<R通用接收检查记录表, Guid> receivingInspectionRecordRepository,

                                    IRepository<R电连接器插接多媒体记录表, Guid> dianlianjieqichajieduomeitijilubiaoRepository,
                                    IRepository<R仪器安装电缆余量多媒体记录表, Guid> yiqianzhuangdianlanyuliangduomeitijilubiaoRepository,
                                    IRepository<R仪器安装分离钢索多媒体记录表, Guid> yiqianzhuangfenligangsuoduomeitijilubiaoRepository,
                                    IRepository<R仪器安装分离力测试多媒体记录表, Guid> yiqianzhuangfenliceshiduomeitijilubiaoRepository,
                                    IRepository<R仪器安装力矩记录表, Guid> yiqianzhuanglijvjilubiaoRepository,
                                    IRepository<R仪器插座安装多媒体记录表, Guid> yiqichazuoanzhuangduomeitijilubiaoRepository,
                                    IRepository<EditFileProcess, Guid> editFileProcessRepository,
                                    IRepository<BackOperationDto, Guid> backOperationDtoProcessRepository,
                                    IRepository<EditFileProcessInfo, Guid> editFileProcessInfoRepository,
                                    IRepository<EditFileStepInfo, Guid> editFileStepInfoRepository,
                                    IRepository<EditFileTableInfo, Guid> editFileTableInfoRepository,
                                    IRepository<EditFileRowInfo, Guid> editFileRowInfoRepository,
                                    IRepository<EditFileTableStructInfo, Guid> editFileTableStructInfoRepository,
                                    IRepository<EditFileTableDataInfo, Guid> editFileTableDataInfoRepository,
                                    IRepository<ClearSignatureRecord, Guid> clearSignatureRecordRepository,
                                    IRepository<ClearSignatureRowData, Guid> clearSignatureRowDataRepository,
                                    IRepository<ClearSignatureDataStruce, Guid> clearSignatureDataStruceRepository

            )
        {
            _organizationUnitRepository = organizationUnitRepository;
            _userOrganizationUnitRepository = userOrganizationUnitRepository;
            _jobWorkerRepository = jobWorkerRepository;
            _bopNodeRepository = bopNodeRepository;
            _bopDescRepository = bopDescRepository;
            _workStepEntityRepository = workStepEntityRepository;
            _productionSchedulerRepository = productionSchedulerRepository;
            _inspectionSeverityDescRepository = inspectionSeverityDescRepository;
            _inspectionTypeDescRepository = inspectionTypeDescRepository;
            _inspectionItemInfoRepository = inspectionItemInfoRepository;
            _inspectionStandardDescRepository = inspectionStandardDescRepository;
            _iOperationHistoryAppService = iOperationHistoryAppService;
            _userRepository = userRepository;
            _operationLogRepository = operationLogRepository;
            _unitOfWorkManager = unitOfWorkManager;
            _uploadPictureRepository = uploadPictureRepository;
            _ibopNodeAppService = ibopNodeAppService;
            _rTechniqueEntityRepository = rTechniqueEntityRepository;
            _processManage = processManage;
            _processesRepository = processesRepository;
            _rTechniqueRepository = rTechniqueRepository;
            _loadPieceRepository = loadPieceRepository;
            _videoEntityRepository = videoEntityRepository;
            _makeResourcesEntityRepository = makeResourcesEntityRepository;
            _mainPartsRepository = mainPartsRepository;
            _hatchRepository = hatchRepository;
            _momentRecordRepository = momentRecordRepository;
            _momentRepository = momentRepository;
            _multiMediaRepository = multiMediaRepository;
            _totalDataRepository = totalDataRepository;
            _liquidRatioRepository = liquidRatioRepository;
            _controlrecordRepository = controlrecordRepository;
            _enterRegisterRepository = enterRegisterRepository;
            _generalRecordsRepository = generalRecordsRepository;
            _RprocessesRepository = RprocessesRepository;
            _RWorkStepRepository = RWorkStepRepository;
            _cableRepository = cableRepository;
            _connectorRepository = connectorRepository;
            _rippleRepository = rippleRepository;
            _adiabaticRemovalRepository = adiabaticRemovalRepository;
            _arrowScalageProductsRepository = arrowScalageProductsRepository;
            _arrowStructureWaterproofRepository = arrowStructureWaterproofRepository;
            _cableHeightRepository = cableHeightRepository;
            _blowPipeArrowRepository = blowPipeArrowRepository;
            _cableReceivingInspectionRepository = cableReceivingInspectionRepository;
            _automaticShutoffRepository = automaticShutoffRepository;
            _assemnleweighingRepository = assemnleweighingRepository;
            _arrowWeightRepository = arrowWeightRepository;
            _calibrationContinuousTorqueRepository = calibrationContinuousTorqueRepository;
            _catheterizationRepository = catheterizationRepository;
            _checkFairingAfterInstallationRepository = checkFairingAfterInstallationRepository;
            _confirmationStatusRepository = confirmationStatusRepository;
            _correspondingRelationshipRepository = correspondingRelationshipRepository;
            _crimpingSealedPlugRepository = crimpingSealedPlugRepository;
            _cylinderGroupRepository = cylinderGroupRepository;
            _cylinderPressureTestRepository = cylinderPressureTestRepository;
            _desiccantInspectionRepository = desiccantInspectionRepository;
            _designGeneralAssembleRepository = designGeneralAssembleRepository;
            _detonatingCableSizeRepository = detonatingCableSizeRepository;
            _disassemblyReassemblyRepository = disassemblyReassemblyRepository;
            _dockSurfaceMorphemeRepository = dockSurfaceMorphemeRepository;
            _experimentalCrimpingRepository = experimentalCrimpingRepository;
            _failureAequiredLoosInsuranceRepository = failureAequiredLoosInsuranceRepository;
            _filingFileRepairRepository = filingFileRepairRepository;
            _finalAssemblyPartsRepository = finalAssemblyPartsRepository;
            _firstIMUInstallationRepository = firstIMUInstallationRepository;
            _forcedCheckpointRepository = forcedCheckpointRepository;
            _flightMassCentroidTareWeightRepository = flightMassCentroidTareWeightRepository;
            _gasPipeTestRepository = gasPipeTestRepository;
            _gasSealFlowTestRepository = gasSealFlowTestRepository;
            _generalWeighingRepository = generalWeighingRepository;
            _hatchOpenShutTestRepository = hatchOpenShutTestRepository;
            _heliumMassSpectrometryRepository = heliumMassSpectrometryRepository;
            _highFrequencyCableStrippingRepository = highFrequencyCableStrippingRepository;
            _highFrequencyVoltageRepository = highFrequencyVoltageRepository;
            _inspectionRecordRepository = inspectionRecordRepository;
            _installationDistanceRepository = installationDistanceRepository;
            _installationLocationRepository = installationLocationRepository;
            _installationPipeCushionRepository = installationPipeCushionRepository;
            _installationQuantityRepository = installationQuantityRepository;
            _instrumentCheckRepository = instrumentCheckRepository;
            _insulation703Repository = insulation703Repository;
            _interfaceCheckRepository = interfaceCheckRepository;
            _jobDivisionRepository = jobDivisionRepository;
            _largePartsDeliveryRepository = largePartsDeliveryRepository;
            _largeSectionWeightRepository = largeSectionWeightRepository;
            _levelingDataFlightRepository = levelingDataFlightRepository;
            _liquidLevelSensorRepository = liquidLevelSensorRepository;
            _loadBracketRepository = loadBracketRepository;
            _lowCrimpingExperimentRepository = lowCrimpingExperimentRepository;
            _lowFrequencyCableStrippingRepository = lowFrequencyCableStrippingRepository;
            _measurementSpacingConduitRepository = measurementSpacingConduitRepository;
            _plugStatusRepository = plugStatusRepository;
            _problemRecordRepository = problemRecordRepository;
            _productGroundingStatusRepository = productGroundingStatusRepository;
            _productInstallationConfirmationRepository = productInstallationConfirmationRepository;
            _protectivePartsRepository = protectivePartsRepository;
            _quadrantCheckRepository = quadrantCheckRepository;
            _secondIMUInstallationRepository = secondIMUInstallationRepository;
            _sensorInstallationRepository = sensorInstallationRepository;
            _soapBubbleRepository = soapBubbleRepository;
            _systemPressureMaintainingRepository = systemPressureMaintainingRepository;
            _statusCheckRepository = statusCheckRepository;
            _tensileStrengthHighRepository = tensileStrengthHighRepository;
            _tailCoverSolenoidRepository = tailCoverSolenoidRepository;
            _transverseCentroidRepository = transverseCentroidRepository;
            _valvesGasInspectionRepository = valvesGasInspectionRepository;
            _valveTestRepository = valveTestRepository;
            _valveTestSecRepository = valveTestSecRepository;
            _valveUsageTimesRepository = valveUsageTimesRepository;
            _releaseSpringCompressionRepository = releaseSpringCompressionRepository;
            _waterproofInstallationLapdRepository = waterproofInstallationLapdRepository;
            _receivingInspectionRecordRepository = receivingInspectionRecordRepository;
            _arrowInterfaceProtectCheckRepository = arrowInterfaceProtectCheckRepository;
            _rTableBaseEntity = rTableBaseEntity;
            _operationHistoryRepository = operationHistoryRepository;
            _editFileProcessRepository = editFileProcessRepository;
            _backOperationDtoProcessRepository = backOperationDtoProcessRepository;
            _editFileProcessInfoRepository = editFileProcessInfoRepository;
            _editFileStepInfoRepository = editFileStepInfoRepository;
            _editFileTableInfoRepository = editFileTableInfoRepository;
            _editFileRowInfoRepository = editFileRowInfoRepository;
            _editFileTableStructInfoRepository = editFileTableStructInfoRepository;
            _editFileTableDataInfoRepository = editFileTableDataInfoRepository;
            _clearSignatureRecordRepository = clearSignatureRecordRepository;
            _clearSignatureRowDataRepository = clearSignatureRowDataRepository;
            _clearSignatureDataStruceRepository = clearSignatureDataStruceRepository;
            _dianlianjieqichajieduomeitijilubiaoRepository = dianlianjieqichajieduomeitijilubiaoRepository;
            _yiqianzhuangdianlanyuliangduomeitijilubiaoRepository = yiqianzhuangdianlanyuliangduomeitijilubiaoRepository;
            _yiqianzhuangfenligangsuoduomeitijilubiaoRepository = yiqianzhuangfenligangsuoduomeitijilubiaoRepository;
            _yiqianzhuangfenliceshiduomeitijilubiaoRepository = yiqianzhuangfenliceshiduomeitijilubiaoRepository;
            _yiqianzhuanglijvjilubiaoRepository = yiqianzhuanglijvjilubiaoRepository;
            _yiqichazuoanzhuangduomeitijilubiaoRepository = yiqichazuoanzhuangduomeitijilubiaoRepository;
                              
        }
        public async Task<TechDoc.TechDocDto> realGetTechDocsByPps(string techniqueNum)
        {
            var dto = await techDocClient.RealGetTechDocsByPps(techniqueNum, null);
            return dto;
        }
        /// <summary>
        /// 解析工艺文件
        /// </summary>
        /// <param name="techniqueName"></param>
        /// <returns></returns>
        public async Task CreateTechInfoFromUrl(string techniqueNum)
        {
            if (QualityConsts.IsRealEnvironment)
            {
                var dto = await techDocClient.RealGetTechDocsByPps(techniqueNum, null);
                if (dto == null)
                {
                    throw new UserFriendlyException("PPS中未同步到" + techniqueNum + "的相应信息！");
                }
                await _processManage.CreateTechInfoFromHtml(dto, techniqueNum);
            }
            else
            {
                var dto = await techDocClient.FakeGetTechDocByPps(techniqueNum, null);
                if (dto == null)
                {
                    throw new UserFriendlyException("PPS中未同步到" + techniqueNum + "的相应信息！");
                }
                await _processManage.CreateTechInfoFromHtml(dto, techniqueNum);
            }
        }
        /// <summary>
        /// 靶场解析
        /// </summary>
        /// <param name="file"></param>
        /// <returns></returns>
        public async Task CreateTechInfoFromLocal(IFormFile file)
        {
            var filePath = "";
            if (file != null)
            {
                //文件格式
                var fileExtension = Path.GetExtension(file.FileName);

                //文件名称
                var jsonName = file.FileName.Split('.')[0];

                //文件保存的路径(应用的工作目录+文件夹相对路径);
                string fileSavePath = Environment.CurrentDirectory + "\\wwwroot\\DownLoadFileRootPath";
                if (!Directory.Exists(fileSavePath))
                {
                    Directory.CreateDirectory(fileSavePath);
                }

                var uniqueFileName = jsonName + fileExtension;
                filePath = Path.Combine(fileSavePath, uniqueFileName);
                using (var fileStream = new FileStream(filePath, FileMode.Create))
                {
                    file.CopyTo(fileStream);
                    fileStream.Flush();
                }
                //获得当前文件夹名称
                var fileSave = uniqueFileName.Split('.')[0];
                //解压文件
                (new FastZip()).ExtractZip(@filePath, @fileSavePath + "/" + fileSave, "");
                //   var josnname = file.FileName.Split('.')[0];
                filePath = fileSavePath + "/" + fileSave + "/" + jsonName + ".html";
                //解析文件
            }
            else
            {
                throw new UserFriendlyException("文件不能为空");
            }

            await _processManage.CreateTechInfoFromLocalHtml(filePath);

        }
        List<EditFileProcessInfo> editFileProcessInfoList = new List<EditFileProcessInfo>();
        EditFileProcessInfo editFileProcessInfo = new EditFileProcessInfo();
        EditFileStepInfo editFileStepInfo = new EditFileStepInfo();
        List<EditFileStepInfo> editFileStepInfoList = new List<EditFileStepInfo>();
        EditFileTableInfo editFileTableInfo = new EditFileTableInfo();
        List<EditFileTableInfo> editFileTableInfoList = new List<EditFileTableInfo>();
        EditFileRowInfo editFileRowInfo = new EditFileRowInfo();
        List<EditFileRowInfo> editFileRowInfolist = new List<EditFileRowInfo>();
        List<EditFileTableStructInfo> editFileTableStrunctInfoList = new List<EditFileTableStructInfo>();
        EditFileTableStructInfo editFileTableStrunctInfo = new EditFileTableStructInfo();
        EditFileTableDataInfo editFileTableDataInfo = new EditFileTableDataInfo();
        List<EditFileTableDataInfo> editFileTableDataInfoList = new List<EditFileTableDataInfo>();

        ///// <summary>
        ///// 返回json文件入库
        ///// </summary>
        ///// <param name="filepath"></param>
        ///// <returns></returns>
        //public async Task<string> AnalysisReturnJsonNew(BackTaskInput input)
        //{
        //    Guid editFileProcessInfoId = Guid.Empty;
        //    string message = "";
        //    //获取所有用户
        //    var userList = _userRepository.GetAll();

        //    if (input.BackTask.Count > 0)
        //    {
        //        for (int p = 0; p < input.BackTask.Count; p++)
        //        {
        //            var tempTask = input.BackTask[p];
        //            var tempTechSearch = await _rTechniqueEntityRepository.FirstOrDefaultAsync(c => c.TechniqueNumber == tempTask.TechniqueNum);
        //            if (tempTechSearch != null)
        //            {
        //                try
        //                {
        //                    var jsonStr = ReadJson.GetFileJson(tempTask.FilePath);
        //                    var ReturnBopTaskOutDto = JsonConvert.DeserializeObject<ReturnBopTaskOutDto>(jsonStr);

        //                    if (ReturnBopTaskOutDto.TechniqueTask != null)
        //                    {
        //                        #region 2021 10 18 Edit by DaoBen 

        //                        var tempTech = await _rTechniqueEntityRepository.FirstOrDefaultAsync(c => c.Id == ReturnBopTaskOutDto.TechniqueTask.Id);
        //                        if (tempTech != null)
        //                        {
        //                            await _rTechniqueEntityRepository.DeleteAsync(d => d.Id == tempTech.Id);
        //                            await _RprocessesRepository.DeleteAsync(d => d.RTechniqueEntityId == tempTech.Id);
        //                            var tempWorkList = (from temp1 in _RWorkStepRepository.GetAll().Where(d => d.RTechniqueEntityId == tempTech.Id)
        //                                                join temp2 in _rTableBaseEntity.GetAllIncluding(a => a.RecordRequirements, b => b.InspectionSignature, c => c.MeasuredResult, d => d.Environment, e => e.MultiMedia) on temp1.Id equals temp2.RWorkStepEntityId
        //                                                select temp2).ToList();
        //                            var tempLoadList = (from temp1 in _RWorkStepRepository.GetAll().Where(d => d.RTechniqueEntityId == tempTech.Id)
        //                                                join temp2 in _loadPieceRepository.GetAll() on temp1.Id equals temp2.RWorkStepEntityId
        //                                                select temp2).ToList();
        //                            var tempMakeList = (from temp1 in _RWorkStepRepository.GetAll().Where(d => d.RTechniqueEntityId == tempTech.Id)
        //                                                join temp2 in _makeResourcesEntityRepository.GetAll() on temp1.Id equals temp2.RWorkStepEntityId
        //                                                select temp2).ToList();
        //                            var tempVideoList = (from temp1 in _RWorkStepRepository.GetAll().Where(d => d.RTechniqueEntityId == tempTech.Id)
        //                                                 join temp2 in _videoEntityRepository.GetAll() on temp1.Id equals temp2.RWorkStepEntityId
        //                                                 select temp2).ToList();

        //                            await _RWorkStepRepository.DeleteAsync(d => d.RTechniqueEntityId == tempTech.Id);
        //                            foreach (var item in tempWorkList)
        //                            {
        //                                await _rTableBaseEntity.DeleteAsync(item);
        //                            }
        //                            foreach (var item in tempLoadList)
        //                            {
        //                                await _loadPieceRepository.DeleteAsync(item);
        //                            }
        //                            foreach (var item in tempMakeList)
        //                            {
        //                                await _makeResourcesEntityRepository.DeleteAsync(item);
        //                            }
        //                            foreach (var item in tempVideoList)
        //                            {
        //                                await _videoEntityRepository.DeleteAsync(item);
        //                            }
        //                        }

        //                        #endregion
        //                    }
        //                    var techniqueList = ObjectMapper.Map<RTechniqueEntity>(ReturnBopTaskOutDto.TechniqueTask);
        //                    techniqueList.Id = Guid.NewGuid();
        //                    techniqueList.TechniqueEntityId = ReturnBopTaskOutDto.TechniqueTask.Id;
        //                    techniqueList.LotNo = ReturnBopTaskOutDto.LotNo;
        //                    techniqueList.Model = ReturnBopTaskOutDto.Model;
        //                    techniqueList.ProcessesEntities = new List<RProcessesEntity>();

        //                    //工艺文件，工序，工步， 表
        //                    var techniqueReturnId = await InsertAll(ReturnBopTaskOutDto.TechniqueTask, techniqueList);
        //                    //接口传
        //                    _ibopNodeAppService.UpdateReturnStatus(ReturnBopTaskOutDto.TechniqueTask.BopNodeId, techniqueList.Id);

        //                    Common.TableMapConfig tableMapConfig = new Common.TableMapConfig();
        //                    Dictionary<string, FiledNodeMap> filedMap = tableMapConfig.InitFiledNodeMap();
        //                    User user;
        //                    var bopNodeFirst = _bopNodeRepository.FirstOrDefault(d => d.TechniqueEntityId == techniqueList.TechniqueEntityId);
        //                    var nodeDescId = bopNodeFirst.BopDescId;
        //                    var bopDesc = _bopDescRepository.FirstOrDefault(d => d.Id == nodeDescId);
        //                    if (ReturnBopTaskOutDto._editFileList != null)
        //                    {
        //                        foreach (var item in ReturnBopTaskOutDto._editFileList)
        //                        {
        //                            deleteEditFile(ReturnBopTaskOutDto.Id);
        //                            //这样传入返回新的Techid 就可以查出所有信息
        //                            item.RTechniqueEntityId = techniqueReturnId;
        //                            item.FileProcessSpecificationId = ReturnBopTaskOutDto.Id;
        //                            //根据用户名获取用户Id
        //                            user = userList.FirstOrDefault(s => s.UserName == item.CreatorUserName);
        //                            if (user != null)
        //                            {
        //                                item.CreatorUserId = user.Id;
        //                            }

        //                            //CurrentUnitOfWork.SaveChanges();
        //                            OperationLog tempLog = new OperationLog();
        //                            tempLog.BusinessId = techniqueList.TechniqueEntityId;
        //                            tempLog.BusinessType = BusinessTypes.Bop质量变更记录;
        //                            tempLog.OperationType = OperationTypes.默认修改;
        //                            tempLog.Content = DateTime.Now.ToShortDateString() + "回传版本" + item._editVersion;
        //                            if (user != null)
        //                            {
        //                                tempLog.CreatorUserId = user.Id;
        //                            }
        //                            _operationHistoryRepository.Insert(tempLog);

        //                            var pphr = item._editFileList.OrderBy(t => t.CreateTime).ToList();
        //                            for (int j = 0; j < pphr.Count; j++)
        //                            {
        //                                RtableNameDictionary table = new RtableNameDictionary();
        //                                var currentPro = ReturnBopTaskOutDto.TechniqueTask.ProcessesListDto.Where(d => d.Id == item._editFileList[j].ProcessId).FirstOrDefault();
        //                                string techName = "";
        //                                WorkStepReturnDto currentWork = new WorkStepReturnDto();
        //                                if (currentPro != null)
        //                                {
        //                                    if (item._editFileList[j].StepId != null)
        //                                    {
        //                                        currentWork = currentPro.WorkStepListDto.Where(d => d.Id == item._editFileList[j].StepId).FirstOrDefault();
        //                                    }
        //                                }
        //                                string tableFieldName = "";
        //                                string fieldname = "";
        //                                string ProName = "";
        //                                string WorkName = "";
        //                                if (currentPro != null)
        //                                {

        //                                    ProName = "工序" + currentPro.ProcessesSequence.ToString();

        //                                    var isExistProcess = editFileProcessInfoList.Count(t => t.EditFileProcessId == currentPro.Id);
        //                                    if (isExistProcess == 0)
        //                                    {
        //                                        if (currentWork == null)
        //                                        {
        //                                            editFileProcessInfo = new EditFileProcessInfo
        //                                            {
        //                                                Id = item._editFileList[j].Id,
        //                                                EditFileProcessId = item._editFileList[j].EditFileProcessId,
        //                                                UniqueId = item._editFileList[j].UniqueId,
        //                                                ProcessesName = currentPro.ProcessesSequence.ToString(),
        //                                                ProcessesSequence = currentPro.ProcessesSequence,
        //                                                ProcessesCharacteristic = currentPro.ProcessesCharacteristic,
        //                                                ProcessesExplain = item._editFileList[j].OldValue,
        //                                                UpdateProcessesExplain = item._editFileList[j].NewValue,
        //                                                UpdateProcessContent = true,
        //                                                // CreatorUserId = user.Id
        //                                            };
        //                                            // editFileProcessInfo.EditFileStepInfos = editFileStepInfoList;
        //                                            editFileProcessInfoList.Add(editFileProcessInfo);
        //                                        }
        //                                        else
        //                                        {
        //                                            editFileProcessInfo = new EditFileProcessInfo
        //                                            {
        //                                                Id = currentPro.Id,
        //                                                EditFileProcessId = currentPro.Id,
        //                                                UniqueId = item._editFileList[j].UniqueId,
        //                                                ProcessesName = currentPro.ProcessesSequence.ToString(),
        //                                                ProcessesSequence = currentPro.ProcessesSequence,
        //                                                ProcessesCharacteristic = currentPro.ProcessesCharacteristic,
        //                                                ProcessesExplain = currentPro.ProcessesExplain,
        //                                                UpdateProcessesExplain = "",
        //                                                UpdateProcessContent = false,
        //                                                //CreatorUserId = user.Id
        //                                            };
        //                                            //editFileProcessInfo.EditFileStepInfos = currentWork;
        //                                            editFileProcessInfoList.Add(editFileProcessInfo);
        //                                        }
        //                                    }
        //                                }
        //                                if (currentWork != null)
        //                                {
        //                                    WorkName = "工步" + currentWork.WorkStepNumber.ToString();
        //                                }
        //                                foreach (KeyValuePair<string, FiledNodeMap> kvp in filedMap)
        //                                {
        //                                    string tempStr = item._editFileList[j].TableFieldName;
        //                                    if (!string.IsNullOrEmpty(tempStr))
        //                                    {
        //                                        if (kvp.Value.filedNodeDto.ToLower() == tempStr.ToLower())
        //                                        {
        //                                            tableFieldName = kvp.Key;
        //                                            int index = kvp.Value.filedValue.IndexOf(char.ToLower(tempStr[0]) + tempStr.Substring(1));
        //                                            if (index != -1)
        //                                            {
        //                                                fieldname = kvp.Value.filedKey[index];
        //                                            }
        //                                        }
        //                                    }
        //                                }
        //                                OperationLog operationLog = new OperationLog();
        //                                //  operationLog.BusinessId = techniqueList.Id;
        //                                operationLog.BusinessType = BusinessTypes.Bop质量变更记录;
        //                                if (item._editFileList[j].CreatorUserName != null)
        //                                {
        //                                    string userName = "";
        //                                    user = userList.FirstOrDefault(s => s.UserName == item._editFileList[j].CreatorUserName);
        //                                    if (user != null)
        //                                    {
        //                                        userName = user.Surname + user.Name;
        //                                        operationLog.UserName = userName;
        //                                        operationLog.UserId = user.Id;
        //                                    }
        //                                }

        //                                var opertionData = item._editFileList[j];
        //                                string str = "";
        //                                string difValue = "";
        //                                switch (opertionData.Type)
        //                                {
        //                                    case 0:
        //                                        operationLog.OperationType = OperationTypes.编辑表格内容;

        //                                        editFileRowInfolist = new List<EditFileRowInfo>();
        //                                        // editFileTableDataInfoList = new List<EditFileTableDataInfo>();
        //                                        editFileTableStrunctInfoList = new List<EditFileTableStructInfo>();
        //                                        var filterProcessAddTableRowContent = editFileProcessInfoList.FirstOrDefault(t => t.Id == opertionData.ProcessId);
        //                                        var propertyInfo = currentWork.GetType().GetProperty(opertionData.TableFieldName);
        //                                        object value = propertyInfo.GetValue(currentWork, null);
        //                                        dynamic dica = default;
        //                                        foreach (var obj in ((dynamic)value))
        //                                        {
        //                                            if (obj.Id == opertionData.RowId.Value)
        //                                            {
        //                                                dica = obj;
        //                                            }
        //                                        }
        //                                        //if (filterProcessAddTable != null)
        //                                        //{
        //                                        //找到工步
        //                                        var filterStepDataContent = filterProcessAddTableRowContent.EditFileStepInfos?.FirstOrDefault(t => t.Id == opertionData.StepId);

        //                                        if (filterStepDataContent != null)
        //                                        {

        //                                            //找到表
        //                                            var tableData = filterStepDataContent.EditFileTableInfos?.FirstOrDefault(t => t.EditFileStepInfoId == opertionData.StepId && t.TableFieldName == opertionData.TableFieldName);
        //                                            if (tableData != null)
        //                                            {

        //                                                var tableDataRow = tableData.EditFileRowInfos?.FirstOrDefault(t => t.Id == opertionData.RowId.Value);
        //                                                if (tableDataRow != null)
        //                                                {
        //                                                    //dynamic list = ((dynamic)value).Id;

        //                                                    var tableDataRowSource = tableDataRow.EditFileTableDataInfos?.FirstOrDefault(t => t.EditFileRowInfoId == opertionData.RowId.Value && t.FieldName == opertionData.FieldName);
        //                                                    if (tableDataRowSource != null)
        //                                                    {
        //                                                        difValue = opertionData.NewValue.Exceptblanks().SplitHtml2().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks().SplitHtml2());
        //                                                        if (difValue != "")
        //                                                        {
        //                                                            //str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
        //                                                            //str = opertionData.OldValue + "<ins style='background:#e6ffe6;'><strong>" + difValue + "</strong></ins>";
        //                                                            str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
        //                                                        }
        //                                                        else
        //                                                        {
        //                                                            str = opertionData.OldValue;
        //                                                        }

        //                                                        editFileTableDataInfo = new EditFileTableDataInfo
        //                                                        {

        //                                                            EditFileRowInfoId = tableDataRow.Id,
        //                                                            //      UniqueId = tableDataRow.UniqueId,
        //                                                            FieldName = opertionData.FieldName,
        //                                                            DisplayName = opertionData.FieldDisplayName,
        //                                                            Value = str,
        //                                                            NewValue = opertionData.NewValue,
        //                                                            Show = true
        //                                                        };

        //                                                        tableDataRowSource = editFileTableDataInfo;
        //                                                    }
        //                                                    else
        //                                                    {

        //                                                        Dictionary<string, string> diction = new Dictionary<string, string>();
        //                                                        if (dica != null)
        //                                                        {
        //                                                            //获取所有字段

        //                                                            //找到该行的全部数据添加到字典
        //                                                            var prop = dica.GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
        //                                                            foreach (var ac in prop)
        //                                                            {
        //                                                                //var val =((dynamic)ac).GetValue(dica);
        //                                                                diction.Add(((dynamic)ac).Name, Convert.ToString(((dynamic)ac).GetValue(dica)));
        //                                                            }
        //                                                        }
        //                                                        table.TableKey = fieldname;
        //                                                        table.TableName = tableFieldName;
        //                                                        table.FiledDesc = filedMap[table.TableName].filedValue;
        //                                                        table.FiledName = filedMap[table.TableName].filedKey;
        //                                                        //循环赋值
        //                                                        var editFileTableDataInfoByRowId = tableDataRow.EditFileTableDataInfos?.Count(t => t.EditFileRowInfoId == opertionData.RowId);
        //                                                        if (editFileTableDataInfoByRowId == null || editFileTableDataInfoByRowId == 0)
        //                                                        {
        //                                                            for (int i = 0; i < table.FiledDesc.Count; i++)
        //                                                            {
        //                                                                foreach (var dicStr in diction)
        //                                                                {
        //                                                                    var dicKey = dicStr.Key;
        //                                                                    var dicValue = dicStr.Value;
        //                                                                    var tableFiled = table.FiledDesc[i].ToLower();
        //                                                                    if (dicKey.ToLower() == tableFiled)
        //                                                                    {

        //                                                                        editFileTableDataInfo = new EditFileTableDataInfo
        //                                                                        {
        //                                                                            EditFileRowInfoId = editFileRowInfo.Id,
        //                                                                            //  UniqueId = tableDataRow.UniqueId,
        //                                                                            FieldName = table.FiledDesc[i],
        //                                                                            DisplayName = table.FiledName[i],
        //                                                                            Show = true,
        //                                                                            Value = dicValue
        //                                                                        };

        //                                                                        tableDataRow.EditFileTableDataInfos.Add(editFileTableDataInfo);

        //                                                                    }
        //                                                                }
        //                                                            }
        //                                                        }

        //                                                        var addMs = tableDataRow.EditFileTableDataInfos.FirstOrDefault(t => t.FieldName.ToLower() == opertionData.FieldName.ToLower());
        //                                                        if (addMs != null)
        //                                                        {
        //                                                            if (addMs.Value != opertionData.OldValue)
        //                                                            {
        //                                                                difValue = addMs.Value.Exceptblanks().SplitHtml2().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks().SplitHtml2());
        //                                                                if (difValue != "")
        //                                                                {
        //                                                                    //str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
        //                                                                    //str = opertionData.OldValue + "<ins style='background:#e6ffe6;'><strong>" + difValue + "</strong></ins>";
        //                                                                    str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
        //                                                                }
        //                                                                else
        //                                                                {
        //                                                                    str = opertionData.OldValue;
        //                                                                }

        //                                                                addMs.Value = str;
        //                                                            }
        //                                                        }
        //                                                    }
        //                                                }
        //                                                else
        //                                                {

        //                                                    editFileRowInfo = new EditFileRowInfo
        //                                                    {
        //                                                        Id = opertionData.RowId.Value,
        //                                                        //   UniqueId = opertionData.UniqueId,
        //                                                        // EditFileTableInfoId = opertionData.TableId.Value,
        //                                                        NewRow = true,
        //                                                    };
        //                                                    Dictionary<string, string> diction = new Dictionary<string, string>();
        //                                                    if (dica != null)
        //                                                    {
        //                                                        //获取所有字段

        //                                                        //找到该行的全部数据添加到字典
        //                                                        var prop = dica.GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
        //                                                        foreach (var ac in prop)
        //                                                        {
        //                                                            //var val =((dynamic)ac).GetValue(dica);
        //                                                            diction.Add(((dynamic)ac).Name, Convert.ToString(((dynamic)ac).GetValue(dica)));
        //                                                        }
        //                                                    }
        //                                                    table.TableKey = fieldname;
        //                                                    table.TableName = tableFieldName;
        //                                                    table.FiledDesc = filedMap[table.TableName].filedValue;
        //                                                    table.FiledName = filedMap[table.TableName].filedKey;

        //                                                    //循环赋值
        //                                                    var editFileTableDataInfoByRowId = editFileRowInfo.EditFileTableDataInfos?.Count(t => t.EditFileRowInfoId == opertionData.RowId);
        //                                                    if (editFileTableDataInfoByRowId == null || editFileTableDataInfoByRowId == 0)
        //                                                    {
        //                                                        for (int i = 0; i < table.FiledDesc.Count; i++)
        //                                                        {
        //                                                            foreach (var dicStr in diction)
        //                                                            {
        //                                                                var dicKey = dicStr.Key;
        //                                                                var dicValue = dicStr.Value;
        //                                                                var tableFiled = table.FiledDesc[i].ToLower();
        //                                                                if (dicKey.ToLower() == tableFiled)
        //                                                                {

        //                                                                    editFileTableDataInfo = new EditFileTableDataInfo
        //                                                                    {
        //                                                                        EditFileRowInfoId = editFileRowInfo.Id,
        //                                                                        //  UniqueId = tableDataRow.UniqueId,
        //                                                                        FieldName = table.FiledDesc[i],
        //                                                                        DisplayName = table.FiledName[i],
        //                                                                        Show = true,
        //                                                                        Value = dicValue
        //                                                                    };
        //                                                                    if (editFileRowInfo.EditFileTableDataInfos == null)
        //                                                                    {
        //                                                                        editFileRowInfo.EditFileTableDataInfos = new List<EditFileTableDataInfo>();
        //                                                                        editFileRowInfo.EditFileTableDataInfos.Add(editFileTableDataInfo);
        //                                                                    }
        //                                                                    else
        //                                                                    {
        //                                                                        editFileRowInfo.EditFileTableDataInfos.Add(editFileTableDataInfo);
        //                                                                    }
        //                                                                }
        //                                                            }
        //                                                        }
        //                                                    }

        //                                                    var addMs = editFileRowInfo.EditFileTableDataInfos.FirstOrDefault(t => t.FieldName.ToLower() == opertionData.FieldName.ToLower());
        //                                                    if (addMs != null)
        //                                                    {
        //                                                        if (addMs.Value != opertionData.OldValue)
        //                                                        {
        //                                                            difValue = addMs.Value.Exceptblanks().SplitHtml2().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks().SplitHtml2());
        //                                                            // difValue = addMs.Value.Exceptblanks().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks());
        //                                                            if (difValue != "")
        //                                                            {
        //                                                                //str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
        //                                                                //str = opertionData.OldValue + "<ins style='background:#e6ffe6;'><strong>" + difValue + "</strong></ins>";
        //                                                                str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
        //                                                            }
        //                                                            else
        //                                                            {
        //                                                                str = opertionData.OldValue;
        //                                                            }

        //                                                            addMs.Value = str;
        //                                                        }
        //                                                    }
        //                                                    if (tableData.EditFileRowInfos == null)
        //                                                    {
        //                                                        tableData.EditFileRowInfos = new List<EditFileRowInfo>();
        //                                                        tableData.EditFileRowInfos.Add(editFileRowInfo);
        //                                                    }
        //                                                    else
        //                                                    {
        //                                                        tableData.EditFileRowInfos.Add(editFileRowInfo);
        //                                                    }
        //                                                    //  tableData.EditFileRowInfos.Add(editFileRowInfo);
        //                                                }
        //                                            }
        //                                            else
        //                                            {
        //                                                var tableNewBool = item._editFileList.FirstOrDefault(t => t.TableFieldName == opertionData.TableFieldName && t.StepId == opertionData.StepId);

        //                                                //新增表行
        //                                                //否则新增
        //                                                editFileTableInfo = new EditFileTableInfo
        //                                                {
        //                                                    Id = Guid.NewGuid(),
        //                                                    EditFileStepInfoId = opertionData.StepId.Value,
        //                                                    FileProcessesId = opertionData.ProcessId.Value.ToString(),
        //                                                    TableFieldName = opertionData.TableFieldName,
        //                                                    TableName = tableFieldName,
        //                                                    //   UniqueId = opertionData.UniqueId,
        //                                                    NewTable = tableNewBool?.Type != 2 ? false : true
        //                                                };

        //                                                //新增表行
        //                                                editFileRowInfo = new EditFileRowInfo
        //                                                {
        //                                                    Id = opertionData.RowId.Value,
        //                                                    //   UniqueId = opertionData.UniqueId,
        //                                                    // EditFileTableInfoId = opertionData.TableId.Value,
        //                                                    NewRow = false,
        //                                                };
        //                                                Dictionary<string, string> diction = new Dictionary<string, string>();
        //                                                if (dica != null)
        //                                                {
        //                                                    //获取所有字段

        //                                                    //找到该行的全部数据添加到字典
        //                                                    var prop = dica.GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
        //                                                    foreach (var ac in prop)
        //                                                    {
        //                                                        //var val =((dynamic)ac).GetValue(dica);
        //                                                        diction.Add(((dynamic)ac).Name, Convert.ToString(((dynamic)ac).GetValue(dica)));
        //                                                    }
        //                                                }
        //                                                table.TableKey = fieldname;
        //                                                table.TableName = tableFieldName;
        //                                                table.FiledDesc = filedMap[table.TableName].filedValue;
        //                                                table.FiledName = filedMap[table.TableName].filedKey;
        //                                                //循环赋值
        //                                                var editFileTableDataInfoByRowId = editFileRowInfo.EditFileTableDataInfos?.Count(t => t.EditFileRowInfoId == opertionData.RowId);
        //                                                if (editFileTableDataInfoByRowId == null || editFileTableDataInfoByRowId == 0)
        //                                                {
        //                                                    for (int i = 0; i < table.FiledDesc.Count; i++)
        //                                                    {
        //                                                        foreach (var dicStr in diction)
        //                                                        {
        //                                                            var dicKey = dicStr.Key;
        //                                                            var dicValue = dicStr.Value;
        //                                                            var tableFiled = table.FiledDesc[i].ToLower();
        //                                                            if (dicKey.ToLower() == tableFiled)
        //                                                            {
        //                                                                editFileTableDataInfo = new EditFileTableDataInfo
        //                                                                {
        //                                                                    EditFileRowInfoId = editFileRowInfo.Id,
        //                                                                    //  UniqueId = tableDataRow.UniqueId,
        //                                                                    FieldName = table.FiledDesc[i],
        //                                                                    DisplayName = table.FiledName[i],
        //                                                                    Show = true,
        //                                                                    Value = dicValue
        //                                                                };
        //                                                                //else
        //                                                                //{
        //                                                                //    if (difValue == "")
        //                                                                //    {
        //                                                                //        str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\">" + opertionData.NewValue + "</ins>";
        //                                                                //    }
        //                                                                //    else
        //                                                                //    {
        //                                                                //        str = opertionData.OldValue + "<ins style=\"\"background:#e6ffe6;\"\">" + difValue + "</ins>";
        //                                                                //    }
        //                                                                //    editFileTableDataInfo = new EditFileTableDataInfo
        //                                                                //    {
        //                                                                //        EditFileRowInfoId = editFileRowInfo.Id,
        //                                                                //        //  UniqueId = tableDataRow.UniqueId,
        //                                                                //        FieldName = table.FiledDesc[i],
        //                                                                //        DisplayName = table.FiledName[i],
        //                                                                //        Show = true,
        //                                                                //        Value = str
        //                                                                //    };
        //                                                                //}



        //                                                                if (editFileRowInfo.EditFileTableDataInfos == null)
        //                                                                {
        //                                                                    editFileRowInfo.EditFileTableDataInfos = new List<EditFileTableDataInfo>();
        //                                                                    editFileRowInfo.EditFileTableDataInfos.Add(editFileTableDataInfo);
        //                                                                }
        //                                                                else
        //                                                                {
        //                                                                    editFileRowInfo.EditFileTableDataInfos.Add(editFileTableDataInfo);
        //                                                                }
        //                                                            }
        //                                                        }



        //                                                    }
        //                                                }


        //                                                var addMs = editFileRowInfo.EditFileTableDataInfos.FirstOrDefault(t => t.FieldName.ToLower() == opertionData.FieldName.ToLower());
        //                                                if (addMs != null)
        //                                                {
        //                                                    if (addMs.Value != opertionData.OldValue)
        //                                                    {
        //                                                        difValue = addMs.Value.Exceptblanks().SplitHtml2().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks().SplitHtml2());
        //                                                        // difValue = addMs.Value.Exceptblanks().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks());
        //                                                        if (difValue != "")
        //                                                        {
        //                                                            //str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
        //                                                            //str = opertionData.OldValue + "<ins style='background:#e6ffe6;'><strong>" + difValue + "</strong></ins>";
        //                                                            str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
        //                                                        }
        //                                                        else
        //                                                        {
        //                                                            str = opertionData.OldValue;
        //                                                        }

        //                                                        addMs.Value = str;
        //                                                    }
        //                                                }
        //                                                for (int i = 0; i < table.FiledDesc.Count; i++)
        //                                                {
        //                                                    editFileTableStrunctInfo = new EditFileTableStructInfo
        //                                                    {
        //                                                        EditFileTableInfoId = editFileTableInfo.Id,
        //                                                        FieldName = table.FiledDesc[i],
        //                                                        DisplayName = table.FiledName[i],
        //                                                        Index = i,
        //                                                        Show = true
        //                                                    };
        //                                                    editFileTableStrunctInfoList.Add(editFileTableStrunctInfo);
        //                                                }
        //                                                if (editFileTableInfo.EditFileRowInfos == null)
        //                                                {
        //                                                    editFileTableInfo.EditFileRowInfos = new List<EditFileRowInfo>();
        //                                                    editFileTableInfo.EditFileRowInfos.Add(editFileRowInfo);
        //                                                }
        //                                                else
        //                                                {
        //                                                    editFileTableInfo.EditFileRowInfos.Add(editFileRowInfo);
        //                                                }
        //                                                editFileTableInfo.EditFileTableStructInfos = editFileTableStrunctInfoList;
        //                                                if (filterStepDataContent.EditFileTableInfos == null)
        //                                                {
        //                                                    filterStepDataContent.EditFileTableInfos = new List<EditFileTableInfo>();
        //                                                    filterStepDataContent.EditFileTableInfos.Add(editFileTableInfo);
        //                                                }
        //                                                else
        //                                                {
        //                                                    filterStepDataContent.EditFileTableInfos.Add(editFileTableInfo);
        //                                                }

        //                                            }
        //                                        }
        //                                        else
        //                                        {

        //                                            var tableNewBool = item._editFileList.FirstOrDefault(t => t.TableFieldName == opertionData.TableFieldName && t.StepId == opertionData.StepId);
        //                                            //否则新增
        //                                            editFileTableInfo = new EditFileTableInfo
        //                                            {
        //                                                Id = Guid.NewGuid(),
        //                                                EditFileStepInfoId = opertionData.StepId.Value,
        //                                                FileProcessesId = opertionData.ProcessId.Value.ToString(),
        //                                                TableFieldName = opertionData.TableFieldName,
        //                                                TableName = tableFieldName,
        //                                                //    UniqueId = opertionData.UniqueId,
        //                                                NewTable = tableNewBool?.Type != 2 ? false : true
        //                                            };

        //                                            //新增表行
        //                                            editFileRowInfo = new EditFileRowInfo
        //                                            {
        //                                                Id = opertionData.RowId.Value,
        //                                                //   UniqueId = opertionData.UniqueId,
        //                                                // EditFileTableInfoId = opertionData.TableId.Value,
        //                                                NewRow = false,
        //                                            };
        //                                            //editFileTableDataInfo = new EditFileTableDataInfo
        //                                            //{
        //                                            //    EditFileRowInfoId = opertionData.RowId.Value,
        //                                            //    //  UniqueId = tableDataRow.UniqueId,
        //                                            //    FieldName = opertionData.FieldName,
        //                                            //    DisplayName = opertionData.FieldDisplayName,
        //                                            //    Value = opertionData.OldValue,
        //                                            //    NewValue = opertionData.NewValue,
        //                                            //    Show = true
        //                                            //};


        //                                            Dictionary<string, string> diction = new Dictionary<string, string>();
        //                                            if (dica != null)
        //                                            {
        //                                                //获取所有字段

        //                                                //找到该行的全部数据添加到字典
        //                                                var prop = dica.GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
        //                                                foreach (var ac in prop)
        //                                                {
        //                                                    //var val =((dynamic)ac).GetValue(dica);
        //                                                    diction.Add(((dynamic)ac).Name, Convert.ToString(((dynamic)ac).GetValue(dica)));
        //                                                }
        //                                            }
        //                                            table.TableKey = fieldname;
        //                                            table.TableName = tableFieldName;
        //                                            table.FiledDesc = filedMap[table.TableName].filedValue;
        //                                            table.FiledName = filedMap[table.TableName].filedKey;
        //                                            var editFileTableDataInfoByRowId = editFileRowInfo.EditFileTableDataInfos?.Count(t => t.EditFileRowInfoId == opertionData.RowId);
        //                                            if (editFileTableDataInfoByRowId == null || editFileTableDataInfoByRowId == 0)
        //                                            {
        //                                                //循环赋值
        //                                                for (int i = 0; i < table.FiledDesc.Count; i++)
        //                                                {
        //                                                    foreach (var dicStr in diction)
        //                                                    {
        //                                                        var dicKey = dicStr.Key;
        //                                                        var dicValue = dicStr.Value;
        //                                                        var tableFiled = table.FiledDesc[i].ToLower();
        //                                                        if (dicKey.ToLower() == tableFiled)
        //                                                        {
        //                                                            editFileTableDataInfo = new EditFileTableDataInfo
        //                                                            {
        //                                                                EditFileRowInfoId = editFileRowInfo.Id,
        //                                                                //  UniqueId = tableDataRow.UniqueId,
        //                                                                FieldName = table.FiledDesc[i],
        //                                                                DisplayName = table.FiledName[i],
        //                                                                Show = true,
        //                                                                Value = dicValue
        //                                                            };
        //                                                            if (editFileRowInfo.EditFileTableDataInfos == null)
        //                                                            {
        //                                                                editFileRowInfo.EditFileTableDataInfos = new List<EditFileTableDataInfo>();
        //                                                                editFileRowInfo.EditFileTableDataInfos.Add(editFileTableDataInfo);
        //                                                            }
        //                                                            else
        //                                                            {
        //                                                                editFileRowInfo.EditFileTableDataInfos.Add(editFileTableDataInfo);
        //                                                            }
        //                                                        }
        //                                                    }
        //                                                }
        //                                            }



        //                                            var addMs = editFileRowInfo.EditFileTableDataInfos.FirstOrDefault(t => t.FieldName.ToLower() == opertionData.FieldName.ToLower());
        //                                            if (addMs != null)
        //                                            {
        //                                                if (addMs.Value != opertionData.OldValue)
        //                                                {
        //                                                    difValue = addMs.Value.Exceptblanks().SplitHtml2().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks().SplitHtml2());
        //                                                    //   difValue = addMs.Value.Exceptblanks().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks());

        //                                                    if (difValue != "")
        //                                                    {
        //                                                        //str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
        //                                                        //str = opertionData.OldValue + "<ins style='background:#e6ffe6;'><strong>" + difValue + "</strong></ins>";
        //                                                        str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
        //                                                    }
        //                                                    else
        //                                                    {
        //                                                        str = opertionData.OldValue;
        //                                                    }

        //                                                    addMs.Value = str;
        //                                                }
        //                                            }
        //                                            for (int i = 0; i < table.FiledDesc.Count; i++)
        //                                            {
        //                                                editFileTableStrunctInfo = new EditFileTableStructInfo
        //                                                {
        //                                                    EditFileTableInfoId = editFileTableInfo.Id,
        //                                                    FieldName = table.FiledDesc[i],
        //                                                    DisplayName = table.FiledName[i],
        //                                                    Index = i,
        //                                                    Show = true
        //                                                };
        //                                                editFileTableStrunctInfoList.Add(editFileTableStrunctInfo);

        //                                                //var isCz = editFileRowInfo.EditFileTableDataInfos.Count(t => t.FieldName == table.FiledDesc[i]);
        //                                                //if (isCz > 0)
        //                                                //{
        //                                                //    continue;
        //                                                //}
        //                                                //else
        //                                                //{
        //                                                //    editFileTableDataInfo = new EditFileTableDataInfo
        //                                                //    {
        //                                                //        EditFileRowInfoId = opertionData.RowId.Value,
        //                                                //        //  UniqueId = tableDataRow.UniqueId,
        //                                                //        FieldName = table.FiledDesc[i],
        //                                                //        DisplayName = table.FiledName[i],
        //                                                //        Show = true
        //                                                //    };
        //                                                //    editFileRowInfo.EditFileTableDataInfos.Add(editFileTableDataInfo);
        //                                                //}
        //                                            }
        //                                            editFileTableInfo.EditFileTableStructInfos = editFileTableStrunctInfoList;
        //                                            //editFileTableInfo.EditFileRowInfos.Add(editFileRowInfo);
        //                                            if (editFileTableInfo.EditFileRowInfos == null)
        //                                            {
        //                                                editFileTableInfo.EditFileRowInfos = new List<EditFileRowInfo>();
        //                                                editFileTableInfo.EditFileRowInfos.Add(editFileRowInfo);
        //                                            }
        //                                            difValue = opertionData.NewValue.Exceptblanks().SplitHtml2().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks().SplitHtml2());
        //                                            // difValue = opertionData.NewValue.Exceptblanks().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks());
        //                                            if (difValue != "")
        //                                            {
        //                                                //str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
        //                                                //str = opertionData.OldValue + "<ins style='background:#e6ffe6;'><strong>" + difValue + "</strong></ins>";
        //                                                str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
        //                                            }
        //                                            else
        //                                            {
        //                                                str = opertionData.OldValue;
        //                                            }


        //                                            var stepNewBool = item._editFileList.Count(t => t.StepId == opertionData.StepId && t.Type == 4);
        //                                            //NewStep = stepNewBool == 0 ? false : true,
        //                                            //NewStep = stepNewBool.Type !=null? false : true,
        //                                            //否则新增
        //                                            editFileStepInfo = new EditFileStepInfo
        //                                            {
        //                                                Id = opertionData.Id,
        //                                                EditFileProcessInfoId = editFileProcessInfoId,
        //                                                NewStep = stepNewBool == 0 ? false : true,
        //                                                //    UniqueId = opertionData.UniqueId,
        //                                                //TWorkStepContent = str,
        //                                                WorkStepName = WorkName,
        //                                                WorkStepNumber = currentWork?.WorkStepNumber.ToString(),
        //                                                UpdateStepContent = true,
        //                                                WorkStepContent = opertionData.OldValue,
        //                                                WorkStepUpdateContent = opertionData.NewValue,
        //                                                WorkStepWorking = currentWork == null ? 0 : (int)currentWork.WorkStepWorking
        //                                            };
        //                                            if (editFileStepInfo.EditFileTableInfos == null)
        //                                            {
        //                                                editFileStepInfo.EditFileTableInfos = new List<EditFileTableInfo>();
        //                                                editFileStepInfo.EditFileTableInfos.Add(editFileTableInfo);
        //                                            }
        //                                            else
        //                                            {
        //                                                editFileStepInfo.EditFileTableInfos.Add(editFileTableInfo);
        //                                            }
        //                                            //editFileStepInfo.EditFileTableInfos.Add(editFileTableInfo);
        //                                            if (filterProcessAddTableRowContent.EditFileStepInfos == null)
        //                                            {
        //                                                filterProcessAddTableRowContent.EditFileStepInfos = new List<EditFileStepInfo>();
        //                                                filterProcessAddTableRowContent.EditFileStepInfos.Add(editFileStepInfo);
        //                                            }
        //                                            else
        //                                            {
        //                                                filterProcessAddTableRowContent.EditFileStepInfos.Add(editFileStepInfo);
        //                                            }
        //                                            //editFileStepInfoList.Add(editFileStepInfo);
        //                                        }
        //                                        break;
        //                                    case 1:
        //                                        operationLog.OperationType = OperationTypes.表格添加行;
        //                                        editFileRowInfolist = new List<EditFileRowInfo>();
        //                                        editFileTableStrunctInfoList = new List<EditFileTableStructInfo>();
        //                                        var filterProcessAddTableRow = editFileProcessInfoList.FirstOrDefault(t => t.Id == item._editFileList[j].ProcessId);
        //                                        //if (filterProcessAddTable != null)
        //                                        //{
        //                                        //找到工步
        //                                        var filterStepData = filterProcessAddTableRow.EditFileStepInfos?.FirstOrDefault(t => t.Id == item._editFileList[j].StepId);
        //                                        if (filterStepData != null)
        //                                        {
        //                                            //找到表
        //                                            var tableData = filterStepData.EditFileTableInfos?.FirstOrDefault(t => t.EditFileStepInfoId == item._editFileList[j].StepId && t.TableFieldName == item._editFileList[j].TableFieldName);
        //                                            if (tableData != null)
        //                                            {
        //                                                var tableDataRow = tableData.EditFileRowInfos?.FirstOrDefault(t => t.Id == item._editFileList[j].RowId.Value);
        //                                                if (tableDataRow != null)
        //                                                {
        //                                                    //存在则更新
        //                                                    editFileRowInfo = new EditFileRowInfo
        //                                                    {
        //                                                        Id = opertionData.RowId.Value,
        //                                                        // UniqueId = opertionData.UniqueId,
        //                                                        //      EditFileTableInfoId = opertionData.TableId.Value,
        //                                                        NewRow = true
        //                                                    };
        //                                                    tableDataRow = editFileRowInfo;
        //                                                }
        //                                                else
        //                                                {
        //                                                    //否则新增
        //                                                    editFileRowInfo = new EditFileRowInfo
        //                                                    {
        //                                                        Id = opertionData.RowId.Value,
        //                                                        // UniqueId = opertionData.UniqueId,
        //                                                        //      EditFileTableInfoId = opertionData.TableId.Value,
        //                                                        NewRow = true,
        //                                                    };
        //                                                    //editFileRowInfolist.Add(editFileRowInfo);
        //                                                    //tableData.EditFileRowInfos = editFileRowInfolist;
        //                                                    if (tableData.EditFileRowInfos == null)
        //                                                    {
        //                                                        tableData.EditFileRowInfos = new List<EditFileRowInfo>();
        //                                                        tableData.EditFileRowInfos.Add(editFileRowInfo);
        //                                                    }
        //                                                    else
        //                                                    {
        //                                                        tableData.EditFileRowInfos.Add(editFileRowInfo);
        //                                                    }
        //                                                }
        //                                            }
        //                                            else
        //                                            {
        //                                                var tableNewBool = item._editFileList.FirstOrDefault(t => t.TableFieldName == opertionData.TableFieldName && t.StepId == opertionData.StepId);
        //                                                //NewTable = tableNewBool?.Type != 2 ? false : true
        //                                                //否则新增
        //                                                editFileTableInfo = new EditFileTableInfo
        //                                                {
        //                                                    Id = Guid.NewGuid(),
        //                                                    EditFileStepInfoId = opertionData.StepId.Value,
        //                                                    FileProcessesId = opertionData.ProcessId.Value.ToString(),
        //                                                    TableFieldName = opertionData.TableFieldName,
        //                                                    TableName = tableFieldName,
        //                                                    //  UniqueId = opertionData.UniqueId,
        //                                                    NewTable = tableNewBool?.Type != 2 ? false : true
        //                                                };
        //                                                table.TableKey = fieldname;
        //                                                table.TableName = tableFieldName;
        //                                                table.FiledDesc = filedMap[table.TableName].filedValue;
        //                                                table.FiledName = filedMap[table.TableName].filedKey;
        //                                                for (int i = 0; i < table.FiledDesc.Count; i++)
        //                                                {
        //                                                    editFileTableStrunctInfo = new EditFileTableStructInfo
        //                                                    {
        //                                                        EditFileTableInfoId = editFileTableInfo.Id,
        //                                                        FieldName = table.FiledDesc[i],
        //                                                        DisplayName = table.FiledName[i],
        //                                                        Index = i,
        //                                                        Show = true
        //                                                    };
        //                                                    editFileTableStrunctInfoList.Add(editFileTableStrunctInfo);
        //                                                }

        //                                                //foreach (string str in table.FiledDesc)
        //                                                //{

        //                                                //    foreach (string str2 in table.FiledName)
        //                                                //    {
        //                                                //        editFileTableStrunctInfo = new EditFileTableStructInfo
        //                                                //        {
        //                                                //            FieldName = str,
        //                                                //            DisplayName = str2
        //                                                //        };
        //                                                //        editFileTableStrunctInfoList.Add(editFileTableStrunctInfo);
        //                                                //        break;
        //                                                //    }
        //                                                //}


        //                                                //新增表行
        //                                                editFileRowInfo = new EditFileRowInfo
        //                                                {
        //                                                    Id = opertionData.RowId.Value,
        //                                                    //   UniqueId = opertionData.UniqueId,
        //                                                    //   EditFileTableInfoId = opertionData.TableId.Value,
        //                                                    NewRow = true,
        //                                                };
        //                                                if (editFileTableInfo.EditFileRowInfos == null)
        //                                                {
        //                                                    editFileTableInfo.EditFileRowInfos = new List<EditFileRowInfo>();
        //                                                    editFileTableInfo.EditFileRowInfos.Add(editFileRowInfo);
        //                                                }
        //                                                else
        //                                                {
        //                                                    editFileTableInfo.EditFileRowInfos.Add(editFileRowInfo);
        //                                                }
        //                                                editFileTableInfo.EditFileTableStructInfos = editFileTableStrunctInfoList;

        //                                                if (filterStepData.EditFileTableInfos == null)
        //                                                {
        //                                                    filterStepData.EditFileTableInfos = new List<EditFileTableInfo>();
        //                                                    filterStepData.EditFileTableInfos.Add(editFileTableInfo);
        //                                                }
        //                                                else
        //                                                {
        //                                                    filterStepData.EditFileTableInfos.Add(editFileTableInfo);
        //                                                }
        //                                            }
        //                                        }
        //                                        else
        //                                        {
        //                                            var stepNewBool = item._editFileList.Count(t => t.StepId == opertionData.StepId && t.Type == 4);
        //                                            difValue = opertionData.NewValue.Exceptblanks().SplitHtml2().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks().SplitHtml2());
        //                                            if (difValue != "")
        //                                            {
        //                                                //str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
        //                                                //str = opertionData.OldValue + "<ins style='background:#e6ffe6;'><strong>" + difValue + "</strong></ins>";
        //                                                str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
        //                                            }
        //                                            else
        //                                            {
        //                                                str = opertionData.OldValue;
        //                                            }
        //                                            //否则新增
        //                                            editFileStepInfo = new EditFileStepInfo
        //                                            {
        //                                                Id = opertionData.StepId.Value,
        //                                                EditFileProcessInfoId = opertionData.ProcessId.Value,
        //                                                NewStep = stepNewBool == 0 ? false : true,
        //                                                //      UniqueId = opertionData.UniqueId,
        //                                                TWorkStepContent = str,
        //                                                WorkStepName = WorkName,
        //                                                WorkStepNumber = currentWork?.WorkStepNumber.ToString(),
        //                                                UpdateStepContent = true,
        //                                                WorkStepContent = opertionData.OldValue,
        //                                                WorkStepUpdateContent = opertionData.NewValue,
        //                                                WorkStepWorking = currentWork == null ? 0 : (int)currentWork.WorkStepWorking
        //                                            };
        //                                            var tableNewBool = item._editFileList.FirstOrDefault(t => t.TableFieldName == opertionData.TableFieldName && t.StepId == opertionData.StepId);
        //                                            //NewTable = tableNewBool?.Type != 2 ? false : true
        //                                            //否则新增
        //                                            editFileTableInfo = new EditFileTableInfo
        //                                            {
        //                                                Id = Guid.NewGuid(),
        //                                                EditFileStepInfoId = opertionData.StepId.Value,
        //                                                FileProcessesId = opertionData.ProcessId.Value.ToString(),
        //                                                TableFieldName = opertionData.TableFieldName,
        //                                                TableName = tableFieldName,
        //                                                //  UniqueId = opertionData.UniqueId,
        //                                                NewTable = tableNewBool?.Type != 2 ? false : true
        //                                            };
        //                                            table.TableKey = fieldname;
        //                                            table.TableName = tableFieldName;
        //                                            table.FiledDesc = filedMap[table.TableName].filedValue;
        //                                            table.FiledName = filedMap[table.TableName].filedKey;
        //                                            for (int i = 0; i < table.FiledDesc.Count; i++)
        //                                            {
        //                                                editFileTableStrunctInfo = new EditFileTableStructInfo
        //                                                {
        //                                                    EditFileTableInfoId = editFileTableInfo.Id,
        //                                                    FieldName = table.FiledDesc[i],
        //                                                    DisplayName = table.FiledName[i],
        //                                                    Index = i,
        //                                                    Show = true
        //                                                };
        //                                                editFileTableStrunctInfoList.Add(editFileTableStrunctInfo);
        //                                            }

        //                                            editFileTableInfo.EditFileTableStructInfos = editFileTableStrunctInfoList;

        //                                            //新增表行
        //                                            editFileRowInfo = new EditFileRowInfo
        //                                            {
        //                                                Id = opertionData.RowId.Value,
        //                                                //   UniqueId = opertionData.UniqueId,
        //                                                //   EditFileTableInfoId = opertionData.TableId.Value,
        //                                                NewRow = true,
        //                                            };
        //                                            if (editFileTableInfo.EditFileRowInfos == null)
        //                                            {
        //                                                editFileTableInfo.EditFileRowInfos = new List<EditFileRowInfo>();
        //                                                editFileTableInfo.EditFileRowInfos.Add(editFileRowInfo);
        //                                            }
        //                                            else
        //                                            {
        //                                                editFileTableInfo.EditFileRowInfos.Add(editFileRowInfo);
        //                                            }

        //                                            if (editFileStepInfo.EditFileTableInfos == null)
        //                                            {
        //                                                editFileStepInfo.EditFileTableInfos = new List<EditFileTableInfo>();
        //                                                editFileStepInfo.EditFileTableInfos.Add(editFileTableInfo);
        //                                            }
        //                                            else
        //                                            {
        //                                                editFileStepInfo.EditFileTableInfos.Add(editFileTableInfo);
        //                                            }
        //                                            if (filterProcessAddTableRow.EditFileStepInfos == null)
        //                                            {
        //                                                filterProcessAddTableRow.EditFileStepInfos = new List<EditFileStepInfo>();
        //                                                filterProcessAddTableRow.EditFileStepInfos.Add(editFileStepInfo);
        //                                            }
        //                                            else
        //                                            {
        //                                                filterProcessAddTableRow.EditFileStepInfos.Add(editFileStepInfo);
        //                                            }
        //                                        }
        //                                        break;
        //                                    case 2:
        //                                        operationLog.OperationType = OperationTypes.添加表;
        //                                        editFileTableStrunctInfoList = new List<EditFileTableStructInfo>();
        //                                        //editFileTableInfoList.Clear();
        //                                        //operationLog.Content = ProName + "-" + WorkName + ",添加表:" + tableFieldName;
        //                                        //editFileTableInfo = new EditFileTableInfo
        //                                        //{
        //                                        //    Id = opertionData.Id,
        //                                        //    EditFileStepInfoId = opertionData.StepId.Value,
        //                                        //    FileProcessesId = opertionData.ProcessId.Value.ToString(),
        //                                        //    TableFieldName = tableFieldName,
        //                                        //    UniqueId = opertionData.UniqueId,
        //                                        //    NewTable =true
        //                                        //};
        //                                        //editFileTableInfoList.Add(editFileTableInfo);

        //                                        //找到表上的工步

        //                                        var filterProcessAddTable = editFileProcessInfoList.FirstOrDefault(t => t.Id == item._editFileList[j].ProcessId);
        //                                        //if (filterProcessAddTable != null)
        //                                        //{
        //                                        //找到工步
        //                                        var filterStepDataTable = filterProcessAddTable.EditFileStepInfos?.FirstOrDefault(t => t.Id == item._editFileList[j].StepId);

        //                                        if (filterStepDataTable != null)
        //                                        {
        //                                            //找到表
        //                                            var tableData = filterStepDataTable.EditFileTableInfos?.FirstOrDefault(t => t.EditFileStepInfoId == item._editFileList[j].StepId && t.TableFieldName == item._editFileList[j].TableFieldName);
        //                                            if (tableData != null)
        //                                            {
        //                                                //大于0 更新
        //                                                editFileTableInfo = new EditFileTableInfo
        //                                                {
        //                                                    Id = Guid.NewGuid(),
        //                                                    EditFileStepInfoId = opertionData.StepId.Value,
        //                                                    FileProcessesId = opertionData.ProcessId.Value.ToString(),
        //                                                    TableFieldName = opertionData.TableFieldName,
        //                                                    TableName = tableFieldName,
        //                                                    //               UniqueId = opertionData.UniqueId,
        //                                                    NewTable = true
        //                                                };
        //                                                tableData = editFileTableInfo;
        //                                            }
        //                                            else
        //                                            {


        //                                                //否则新增
        //                                                editFileTableInfo = new EditFileTableInfo
        //                                                {
        //                                                    Id = Guid.NewGuid(),
        //                                                    EditFileStepInfoId = opertionData.StepId.Value,
        //                                                    FileProcessesId = opertionData.ProcessId.Value.ToString(),
        //                                                    TableFieldName = opertionData.TableFieldName,
        //                                                    TableName = tableFieldName,
        //                                                    //  UniqueId = opertionData.UniqueId,
        //                                                    NewTable = true
        //                                                };
        //                                                table.TableKey = fieldname;
        //                                                table.TableName = tableFieldName;
        //                                                table.FiledDesc = filedMap[table.TableName].filedValue;
        //                                                table.FiledName = filedMap[table.TableName].filedKey;
        //                                                for (int i = 0; i < table.FiledDesc.Count; i++)
        //                                                {
        //                                                    editFileTableStrunctInfo = new EditFileTableStructInfo
        //                                                    {
        //                                                        EditFileTableInfoId = editFileTableInfo.Id,
        //                                                        FieldName = table.FiledDesc[i],
        //                                                        DisplayName = table.FiledName[i],
        //                                                        Index = i,
        //                                                        Show = true
        //                                                    };
        //                                                    editFileTableStrunctInfoList.Add(editFileTableStrunctInfo);
        //                                                }
        //                                                editFileTableInfo.EditFileTableStructInfos = editFileTableStrunctInfoList;
        //                                                if (filterStepDataTable.EditFileTableInfos == null)
        //                                                {
        //                                                    filterStepDataTable.EditFileTableInfos = new List<EditFileTableInfo>();
        //                                                    filterStepDataTable.EditFileTableInfos.Add(editFileTableInfo);
        //                                                }
        //                                                else
        //                                                {
        //                                                    filterStepDataTable.EditFileTableInfos.Add(editFileTableInfo);
        //                                                }
        //                                            }
        //                                        }
        //                                        else
        //                                        {
        //                                            difValue = opertionData.NewValue.Exceptblanks().SplitHtml2().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks().SplitHtml2());
        //                                            if (difValue != "")
        //                                            {
        //                                                //str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
        //                                                //str = opertionData.OldValue + "<ins style='background:#e6ffe6;'><strong>" + difValue + "</strong></ins>";
        //                                                str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
        //                                            }
        //                                            else
        //                                            {
        //                                                str = opertionData.OldValue;
        //                                            }

        //                                            var stepNewBool = item._editFileList.Count(t => t.StepId == opertionData.StepId && t.Type == 4);
        //                                            //否则新增
        //                                            editFileStepInfo = new EditFileStepInfo
        //                                            {
        //                                                Id = opertionData.StepId.Value,
        //                                                EditFileProcessInfoId = editFileProcessInfoId,
        //                                                NewStep = stepNewBool == 0 ? false : true,
        //                                                //                      UniqueId = opertionData.UniqueId,
        //                                                TWorkStepContent = opertionData.NewValue,
        //                                                WorkStepName = WorkName,
        //                                                WorkStepNumber = currentWork?.WorkStepNumber.ToString(),
        //                                                UpdateStepContent = true,
        //                                                WorkStepContent = opertionData.OldValue,
        //                                                WorkStepUpdateContent = opertionData.NewValue,
        //                                                WorkStepWorking = currentWork == null ? 0 : (int)currentWork.WorkStepWorking
        //                                            };
        //                                            //否则新增
        //                                            editFileTableInfo = new EditFileTableInfo
        //                                            {
        //                                                Id = Guid.NewGuid(),
        //                                                EditFileStepInfoId = opertionData.StepId.Value,
        //                                                FileProcessesId = opertionData.ProcessId.Value.ToString(),
        //                                                TableFieldName = opertionData.TableFieldName,
        //                                                TableName = tableFieldName,
        //                                                //  UniqueId = opertionData.UniqueId,
        //                                                NewTable = true
        //                                            };
        //                                            table.TableKey = fieldname;
        //                                            table.TableName = tableFieldName;
        //                                            table.FiledDesc = filedMap[table.TableName].filedValue;
        //                                            table.FiledName = filedMap[table.TableName].filedKey;
        //                                            for (int i = 0; i < table.FiledDesc.Count; i++)
        //                                            {
        //                                                editFileTableStrunctInfo = new EditFileTableStructInfo
        //                                                {
        //                                                    EditFileTableInfoId = editFileTableInfo.Id,
        //                                                    FieldName = table.FiledDesc[i],
        //                                                    DisplayName = table.FiledName[i],
        //                                                    Index = i,
        //                                                    Show = true
        //                                                };
        //                                                editFileTableStrunctInfoList.Add(editFileTableStrunctInfo);
        //                                            }
        //                                            editFileTableInfo.EditFileTableStructInfos = editFileTableStrunctInfoList;



        //                                            if (editFileStepInfo.EditFileTableInfos == null)
        //                                            {
        //                                                editFileStepInfo.EditFileTableInfos = new List<EditFileTableInfo>();
        //                                                editFileStepInfo.EditFileTableInfos.Add(editFileTableInfo);
        //                                            }
        //                                            else
        //                                            {
        //                                                editFileStepInfo.EditFileTableInfos.Add(editFileTableInfo);
        //                                            }
        //                                            if (filterProcessAddTable.EditFileStepInfos == null)
        //                                            {
        //                                                filterProcessAddTable.EditFileStepInfos = new List<EditFileStepInfo>();
        //                                                filterProcessAddTable.EditFileStepInfos.Add(editFileStepInfo);
        //                                            }
        //                                            else
        //                                            {
        //                                                filterProcessAddTable.EditFileStepInfos.Add(editFileStepInfo);
        //                                            }
        //                                        }

        //                                        break;
        //                                    case 3:
        //                                        operationLog.OperationType = OperationTypes.编辑工步描述;
        //                                        //if (!string.IsNullOrEmpty(opertionData.ProcessId.ToString()) && !string.IsNullOrEmpty(opertionData.StepId.ToString()))
        //                                        //{
        //                                        //    editFileStepInfo = new EditFileStepInfo
        //                                        //    {
        //                                        //        Id = opertionData.Id,
        //                                        //        EditFileProcessInfoId = editFileProcessInfoId,
        //                                        //        NewStep = false,
        //                                        //        UniqueId = opertionData.UniqueId,
        //                                        //        TWorkStepContent = WorkName + currentWork.WorkStepContent,
        //                                        //        WorkStepName = WorkName,
        //                                        //        WorkStepNumber = currentWork.WorkStepNumber.ToString(),
        //                                        //        UpdateStepContent = true,
        //                                        //        WorkStepContent = currentWork.WorkStepContent,
        //                                        //        WorkStepUpdateContent = opertionData.NewValue,
        //                                        //        WorkStepWorking = (int)currentWork.WorkStepWorking
        //                                        //    };
        //                                        //    editFileStepInfoList.Add(editFileStepInfo);
        //                                        //}

        //                                        //判断工序下有没有相关内容

        //                                        var filterProcess = editFileProcessInfoList.FirstOrDefault(t => t.Id == item._editFileList[j].ProcessId);
        //                                        //filterProcess.EditFileStepInfos = new List<EditFileStepInfo>()
        //                                        //找到工步

        //                                        var filterStepDataMs = filterProcess.EditFileStepInfos?.FirstOrDefault(t => t.Id == item._editFileList[j].StepId);
        //                                        if (filterStepDataMs != null)
        //                                        {

        //                                            difValue = opertionData.NewValue.Exceptblanks().SplitHtml2().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks().SplitHtml2());
        //                                            if (difValue != "")
        //                                            {
        //                                                //str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
        //                                                //str = opertionData.OldValue + "<ins style='background:#e6ffe6;'><strong>" + difValue + "</strong></ins>";
        //                                                str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
        //                                            }
        //                                            else
        //                                            {
        //                                                str = opertionData.OldValue;
        //                                            }

        //                                            //大于0 更新

        //                                            filterStepDataMs.Id = opertionData.StepId.Value;
        //                                            filterStepDataMs.EditFileProcessInfoId = opertionData.ProcessId.Value;
        //                                            filterStepDataMs.NewStep = false;
        //                                            //                      UniqueId = opertionData.UniqueId,
        //                                            filterStepDataMs.TWorkStepContent = str;
        //                                            filterStepDataMs.WorkStepName = WorkName;
        //                                            filterStepDataMs.WorkStepNumber = currentWork?.WorkStepNumber.ToString();
        //                                            filterStepDataMs.UpdateStepContent = true;
        //                                            filterStepDataMs.WorkStepContent = currentWork?.WorkStepContent;
        //                                            filterStepDataMs.WorkStepUpdateContent = opertionData.NewValue;
        //                                            filterStepDataMs.WorkStepWorking = currentWork == null ? 0 : (int)currentWork.WorkStepWorking;
        //                                        }
        //                                        else
        //                                        {

        //                                            difValue = opertionData.NewValue.Exceptblanks().SplitHtml2().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks().SplitHtml2());
        //                                            if (difValue != "")
        //                                            {
        //                                                //str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
        //                                                //str = opertionData.OldValue + "<ins style='background:#e6ffe6;'><strong>" + difValue + "</strong></ins>";
        //                                                str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
        //                                            }
        //                                            else
        //                                            {
        //                                                str = opertionData.OldValue;
        //                                            }

        //                                            var stepNewBool = item._editFileList.Count(t => t.StepId == opertionData.StepId && t.Type == 4);
        //                                            //否则新增
        //                                            editFileStepInfo = new EditFileStepInfo
        //                                            {
        //                                                Id = opertionData.StepId.Value,
        //                                                EditFileProcessInfoId = opertionData.ProcessId.Value,
        //                                                NewStep = stepNewBool == 0 ? false : true,

        //                                                //                          UniqueId = opertionData.UniqueId,
        //                                                TWorkStepContent = str,
        //                                                WorkStepName = WorkName,
        //                                                WorkStepNumber = currentWork?.WorkStepNumber.ToString(),
        //                                                UpdateStepContent = true,
        //                                                WorkStepContent = opertionData.OldValue,
        //                                                WorkStepUpdateContent = opertionData.NewValue,
        //                                                WorkStepWorking = currentWork == null ? 0 : (int)currentWork.WorkStepWorking
        //                                            };
        //                                            //if (editFileStepInfo.EditFileTableInfos == null)
        //                                            //{
        //                                            //    editFileStepInfo.EditFileTableInfos = new List<EditFileTableInfo>();
        //                                            //    editFileStepInfo.EditFileTableInfos.Add(editFileTableInfo);
        //                                            //}
        //                                            //else
        //                                            //{
        //                                            //    editFileStepInfo.EditFileTableInfos.Add(editFileTableInfo);
        //                                            //}
        //                                            if (filterProcess.EditFileStepInfos == null)
        //                                            {
        //                                                filterProcess.EditFileStepInfos = new List<EditFileStepInfo>();
        //                                                filterProcess.EditFileStepInfos.Add(editFileStepInfo);
        //                                            }
        //                                            else
        //                                            {
        //                                                filterProcess.EditFileStepInfos.Add(editFileStepInfo);
        //                                            }
        //                                        }
        //                                        break;
        //                                    case 4:
        //                                        operationLog.OperationType = OperationTypes.新增工步;
        //                                        //判断工序下有没有相关内容
        //                                        var filterProcessAddStep = editFileProcessInfoList.FirstOrDefault(t => t.Id == item._editFileList[j].ProcessId);
        //                                        difValue = opertionData.NewValue.Exceptblanks().SplitHtml2().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks().SplitHtml2());
        //                                        if (difValue != "")
        //                                        {
        //                                            //str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
        //                                            //str = opertionData.OldValue + "<ins style='background:#e6ffe6;'><strong>" + difValue + "</strong></ins>";
        //                                            str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
        //                                        }
        //                                        else
        //                                        {
        //                                            str = opertionData.OldValue;
        //                                        }

        //                                        //filterProcess.EditFileStepInfos = new List<EditFileStepInfo>()
        //                                        //找到工步
        //                                        var filterStepDataMsStep = filterProcessAddStep.EditFileStepInfos?.FirstOrDefault(t => t.Id == item._editFileList[j].StepId);
        //                                        if (filterStepDataMsStep != null)
        //                                        {


        //                                            //大于0 更新
        //                                            //editFileStepInfo = new EditFileStepInfo
        //                                            //{
        //                                            filterStepDataMsStep.Id = opertionData.Id;
        //                                            filterStepDataMsStep.EditFileProcessInfoId = opertionData.ProcessId.Value;
        //                                            filterStepDataMsStep.NewStep = filterStepDataMsStep.NewStep;
        //                                            //                  filterStepDataMsStep.UniqueId = opertionData.UniqueId;
        //                                            filterStepDataMsStep.TWorkStepContent = str;
        //                                            filterStepDataMsStep.WorkStepName = WorkName;
        //                                            filterStepDataMsStep.WorkStepNumber = currentWork.WorkStepNumber.ToString();
        //                                            filterStepDataMsStep.UpdateStepContent = true;
        //                                            filterStepDataMsStep.WorkStepContent = opertionData.OldValue;
        //                                            filterStepDataMsStep.WorkStepUpdateContent = opertionData.NewValue;
        //                                            filterStepDataMsStep.WorkStepWorking = (int)currentWork.WorkStepWorking;
        //                                            //};
        //                                            //filterStepDataMs = editFileStepInfo;
        //                                        }
        //                                        else
        //                                        {
        //                                            editFileStepInfo = new EditFileStepInfo
        //                                            {
        //                                                Id = opertionData.StepId.Value,
        //                                                EditFileProcessInfoId = opertionData.ProcessId.Value,
        //                                                NewStep = true,
        //                                                //                       UniqueId = opertionData.UniqueId,
        //                                                TWorkStepContent = str,
        //                                                WorkStepName = WorkName,
        //                                                WorkStepNumber = currentWork?.WorkStepNumber.ToString(),
        //                                                UpdateStepContent = true,
        //                                                WorkStepContent = opertionData.OldValue,
        //                                                WorkStepUpdateContent = opertionData.NewValue,
        //                                                WorkStepWorking = currentWork != null ? (int)currentWork?.WorkStepWorking : 0
        //                                            };
        //                                            if (filterProcessAddStep.EditFileStepInfos == null)
        //                                            {
        //                                                filterProcessAddStep.EditFileStepInfos = new List<EditFileStepInfo>();
        //                                                filterProcessAddStep.EditFileStepInfos.Add(editFileStepInfo);
        //                                            }
        //                                            else
        //                                            {
        //                                                filterProcessAddStep.EditFileStepInfos.Add(editFileStepInfo);
        //                                            }
        //                                        }
        //                                        //if (!string.IsNullOrEmpty(opertionData.ProcessId.ToString()) && !string.IsNullOrEmpty(opertionData.StepId.ToString()))
        //                                        //{
        //                                        //    editFileStepInfo = new EditFileStepInfo
        //                                        //    {
        //                                        //        Id = opertionData.Id,
        //                                        //        EditFileProcessInfoId = editFileProcessInfoId,
        //                                        //        NewStep = true,
        //                                        //        UniqueId = opertionData.UniqueId,
        //                                        //        TWorkStepContent = WorkName + currentWork.WorkStepContent,
        //                                        //        WorkStepName = WorkName,
        //                                        //        WorkStepNumber = currentWork.WorkStepNumber.ToString(),
        //                                        //        UpdateStepContent = true,
        //                                        //        WorkStepContent = currentWork.WorkStepContent,
        //                                        //        WorkStepUpdateContent = opertionData.NewValue,
        //                                        //        WorkStepWorking = (int)currentWork.WorkStepWorking
        //                                        //    };
        //                                        //    editFileStepInfoList.Add(editFileStepInfo);
        //                                        //}
        //                                        break;
        //                                    case 5:
        //                                        operationLog.OperationType = OperationTypes.表格删除行;
        //                                        var propertyDelInfo = currentWork.GetType().GetProperty(opertionData.TableFieldName);
        //                                        object valueDel = propertyDelInfo.GetValue(currentWork, null);
        //                                        dynamic dicaDel = default;
        //                                        foreach (var obj in ((dynamic)valueDel))
        //                                        {
        //                                            if (obj.Id == opertionData.RowId.Value)
        //                                            {
        //                                                dica = obj;
        //                                            }
        //                                        }
        //                                        //foreach (var obj in ((dynamic)dicaDel))
        //                                        //{
        //                                        //    if (obj.Id == opertionData.RowId.Value)
        //                                        //    {
        //                                        //        dica = obj;
        //                                        //    }
        //                                        //}
        //                                        var filterProcessDelTableRow = editFileProcessInfoList.FirstOrDefault(t => t.Id == item._editFileList[j].ProcessId);
        //                                        //if (filterProcessAddTable != null)
        //                                        //{
        //                                        //找到工步
        //                                        var filterStepDataDelRow = filterProcessDelTableRow.EditFileStepInfos?.FirstOrDefault(t => t.Id == item._editFileList[j].StepId);
        //                                        if (filterStepDataDelRow != null)
        //                                        {
        //                                            //找到表
        //                                            var tableData = filterStepDataDelRow.EditFileTableInfos?.FirstOrDefault(t => t.EditFileStepInfoId == item._editFileList[j].StepId && t.TableFieldName == item._editFileList[j].TableFieldName);
        //                                            if (tableData != null)
        //                                            {
        //                                                var tableDataRow = tableData.EditFileRowInfos?.FirstOrDefault(t => t.Id == item._editFileList[j].RowId.Value);
        //                                                if (tableDataRow != null)
        //                                                {
        //                                                    //存在则更新

        //                                                    tableDataRow.Id = opertionData.RowId.Value;
        //                                                    //                           tableDataRow.UniqueId = opertionData.UniqueId;
        //                                                    // tableDataRow.EditFileTableInfoId = opertionData.TableId.Value;
        //                                                    tableDataRow.NewRow = tableDataRow.NewRow;
        //                                                    tableDataRow.DeletedRow = tableDataRow.DeletedRow;
        //                                                }
        //                                                else
        //                                                {

        //                                                    Dictionary<string, string> diction = new Dictionary<string, string>();
        //                                                    if (dicaDel != null)
        //                                                    {
        //                                                        //获取所有字段

        //                                                        //找到该行的全部数据添加到字典
        //                                                        var prop = dicaDel.GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
        //                                                        foreach (var ac in prop)
        //                                                        {
        //                                                            //var val =((dynamic)ac).GetValue(dica);
        //                                                            diction.Add(((dynamic)ac).Name, Convert.ToString(((dynamic)ac).GetValue(dicaDel)));
        //                                                        }
        //                                                    }
        //                                                    table.TableKey = fieldname;
        //                                                    table.TableName = tableFieldName;
        //                                                    table.FiledDesc = filedMap[table.TableName].filedValue;
        //                                                    table.FiledName = filedMap[table.TableName].filedKey;
        //                                                    //循环赋值
        //                                                    var editFileTableDataInfoByRowId = tableDataRow.EditFileTableDataInfos?.Count(t => t.EditFileRowInfoId == opertionData.RowId);
        //                                                    if (editFileTableDataInfoByRowId == null || editFileTableDataInfoByRowId == 0)
        //                                                    {
        //                                                        for (int i = 0; i < table.FiledDesc.Count; i++)
        //                                                        {
        //                                                            foreach (var dicStr in diction)
        //                                                            {
        //                                                                var dicKey = dicStr.Key;
        //                                                                var dicValue = dicStr.Value;
        //                                                                var tableFiled = table.FiledDesc[i].ToLower();
        //                                                                if (dicKey.ToLower() == tableFiled)
        //                                                                {

        //                                                                    editFileTableDataInfo = new EditFileTableDataInfo
        //                                                                    {
        //                                                                        EditFileRowInfoId = editFileRowInfo.Id,
        //                                                                        //  UniqueId = tableDataRow.UniqueId,
        //                                                                        FieldName = table.FiledDesc[i],
        //                                                                        DisplayName = table.FiledName[i],
        //                                                                        Show = true,
        //                                                                        Value = dicValue
        //                                                                    };

        //                                                                    tableDataRow.EditFileTableDataInfos.Add(editFileTableDataInfo);

        //                                                                }
        //                                                            }
        //                                                        }
        //                                                    }

        //                                                    //否则新增
        //                                                    editFileRowInfo = new EditFileRowInfo
        //                                                    {
        //                                                        Id = opertionData.RowId.Value,
        //                                                        EditFileTableInfoId = tableData.Id,
        //                                                        // UniqueId = opertionData.UniqueId,
        //                                                        DeletedRow = true,
        //                                                        //      EditFileTableInfoId = opertionData.TableId.Value,
        //                                                        NewRow = false,
        //                                                    };

        //                                                    if (tableData.EditFileRowInfos == null)
        //                                                    {
        //                                                        tableData.EditFileRowInfos = new List<EditFileRowInfo>();
        //                                                        tableData.EditFileRowInfos.Add(editFileRowInfo);
        //                                                    }
        //                                                    else
        //                                                    {
        //                                                        tableData.EditFileRowInfos.Add(editFileRowInfo);
        //                                                    }
        //                                                    //tableData.EditFileRowInfos.Add(editFileRowInfo);
        //                                                    //tableData.EditFileRowInfos = editFileRowInfolist;
        //                                                }
        //                                            }
        //                                            else
        //                                            {
        //                                                var tableNewBool = item._editFileList.FirstOrDefault(t => t.TableFieldName == opertionData.TableFieldName && t.StepId == opertionData.StepId);
        //                                                //NewTable = tableNewBool?.Type != 2 ? false : true
        //                                                //否则新增
        //                                                editFileTableInfo = new EditFileTableInfo
        //                                                {
        //                                                    Id = Guid.NewGuid(),
        //                                                    EditFileStepInfoId = opertionData.StepId.Value,
        //                                                    FileProcessesId = opertionData.ProcessId.Value.ToString(),
        //                                                    TableFieldName = opertionData.TableFieldName,
        //                                                    TableName = tableFieldName,
        //                                                    //  UniqueId = opertionData.UniqueId,
        //                                                    NewTable = tableNewBool?.Type != 2 ? false : true
        //                                                };
        //                                                table.TableKey = fieldname;
        //                                                table.TableName = tableFieldName;
        //                                                table.FiledDesc = filedMap[table.TableName].filedValue;
        //                                                table.FiledName = filedMap[table.TableName].filedKey;
        //                                                for (int i = 0; i < table.FiledDesc.Count; i++)
        //                                                {
        //                                                    editFileTableStrunctInfo = new EditFileTableStructInfo
        //                                                    {
        //                                                        EditFileTableInfoId = editFileTableInfo.Id,
        //                                                        FieldName = table.FiledDesc[i],
        //                                                        DisplayName = table.FiledName[i],
        //                                                        Index = i,
        //                                                        Show = true
        //                                                    };
        //                                                    editFileTableStrunctInfoList.Add(editFileTableStrunctInfo);
        //                                                }
        //                                                editFileTableInfo.EditFileTableStructInfos = editFileTableStrunctInfoList;
        //                                                //新增表行
        //                                                editFileRowInfo = new EditFileRowInfo
        //                                                {
        //                                                    Id = opertionData.Id,
        //                                                    //  UniqueId = opertionData.UniqueId,
        //                                                    //   EditFileTableInfoId = opertionData.TableId.Value,
        //                                                    NewRow = true,
        //                                                };
        //                                                if (editFileTableInfo.EditFileRowInfos == null)
        //                                                {
        //                                                    editFileTableInfo.EditFileRowInfos = new List<EditFileRowInfo>();
        //                                                    editFileTableInfo.EditFileRowInfos.Add(editFileRowInfo);
        //                                                }
        //                                                else
        //                                                {
        //                                                    editFileTableInfo.EditFileRowInfos.Add(editFileRowInfo);
        //                                                }


        //                                                if (filterStepDataDelRow.EditFileTableInfos == null)
        //                                                {
        //                                                    filterStepDataDelRow.EditFileTableInfos = new List<EditFileTableInfo>();

        //                                                }
        //                                                else
        //                                                {
        //                                                    filterStepDataDelRow.EditFileTableInfos.Add(editFileTableInfo);
        //                                                }



        //                                                //filterStepDataDelRow.EditFileTableInfos = editFileTableInfoList;
        //                                            }
        //                                        }
        //                                        else
        //                                        {
        //                                            difValue = opertionData.NewValue.Exceptblanks().SplitHtml2().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks().SplitHtml2());
        //                                            if (difValue != "")
        //                                            {
        //                                                //str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
        //                                                //str = opertionData.OldValue + "<ins style='background:#e6ffe6;'><strong>" + difValue + "</strong></ins>";
        //                                                str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
        //                                            }
        //                                            else
        //                                            {
        //                                                str = opertionData.OldValue;
        //                                            }

        //                                            var stepNewBool = item._editFileList.Count(t => t.StepId == opertionData.StepId && t.Type == 4);
        //                                            //否则新增
        //                                            editFileStepInfo = new EditFileStepInfo
        //                                            {
        //                                                Id = opertionData.StepId.Value,
        //                                                EditFileProcessInfoId = opertionData.ProcessId.Value,
        //                                                NewStep = stepNewBool == 0 ? false : true,
        //                                                //                       UniqueId = opertionData.UniqueId,
        //                                                TWorkStepContent = str,
        //                                                WorkStepName = WorkName,
        //                                                WorkStepNumber = currentWork?.WorkStepNumber.ToString(),
        //                                                UpdateStepContent = true,
        //                                                WorkStepContent = opertionData.OldValue,
        //                                                WorkStepUpdateContent = opertionData.NewValue,
        //                                                WorkStepWorking = currentWork == null ? 0 : (int)currentWork.WorkStepWorking
        //                                            };
        //                                            var tableNewBool = item._editFileList.FirstOrDefault(t => t.TableFieldName == opertionData.TableFieldName && t.StepId == opertionData.StepId);
        //                                            //NewTable = tableNewBool?.Type != 2 ? false : true

        //                                            //否则新增
        //                                            editFileTableInfo = new EditFileTableInfo
        //                                            {
        //                                                Id = Guid.NewGuid(),
        //                                                EditFileStepInfoId = opertionData.StepId.Value,
        //                                                FileProcessesId = opertionData.ProcessId.Value.ToString(),
        //                                                TableFieldName = opertionData.TableFieldName,
        //                                                TableName = tableFieldName,
        //                                                //  UniqueId = opertionData.UniqueId,
        //                                                NewTable = tableNewBool?.Type != 2 ? false : true
        //                                            };
        //                                            table.TableKey = fieldname;
        //                                            table.TableName = tableFieldName;
        //                                            table.FiledDesc = filedMap[table.TableName].filedValue;
        //                                            table.FiledName = filedMap[table.TableName].filedKey;
        //                                            for (int i = 0; i < table.FiledDesc.Count; i++)
        //                                            {
        //                                                editFileTableStrunctInfo = new EditFileTableStructInfo
        //                                                {
        //                                                    EditFileTableInfoId = editFileTableInfo.Id,
        //                                                    FieldName = table.FiledDesc[i],
        //                                                    DisplayName = table.FiledName[i],
        //                                                    Index = i,
        //                                                    Show = true
        //                                                };
        //                                                editFileTableStrunctInfoList.Add(editFileTableStrunctInfo);
        //                                            }


        //                                            editFileTableInfo.EditFileTableStructInfos = editFileTableStrunctInfoList;

        //                                            if (editFileStepInfo.EditFileTableInfos == null)
        //                                            {
        //                                                editFileStepInfo.EditFileTableInfos = new List<EditFileTableInfo>();
        //                                                editFileStepInfo.EditFileTableInfos.Add(editFileTableInfo);
        //                                            }
        //                                            else
        //                                            {
        //                                                editFileStepInfo.EditFileTableInfos.Add(editFileTableInfo);
        //                                            }
        //                                            if (filterProcessDelTableRow.EditFileStepInfos == null)
        //                                            {
        //                                                filterProcessDelTableRow.EditFileStepInfos = new List<EditFileStepInfo>();
        //                                                filterProcessDelTableRow.EditFileStepInfos.Add(editFileStepInfo);
        //                                            }
        //                                            else
        //                                            {
        //                                                filterProcessDelTableRow.EditFileStepInfos.Add(editFileStepInfo);
        //                                            }
        //                                        }
        //                                        break;
        //                                    case 6:
        //                                        operationLog.OperationType = OperationTypes.删除表;
        //                                        //找到表上的工步
        //                                        var filterProcessDelTable = editFileProcessInfoList.FirstOrDefault(t => t.Id == item._editFileList[j].ProcessId);
        //                                        //if (filterProcessAddTable != null)
        //                                        //{
        //                                        //找到工步
        //                                        var filterStepDataDelTable = filterProcessDelTable.EditFileStepInfos?.FirstOrDefault(t => t.Id == item._editFileList[j].StepId);

        //                                        if (filterStepDataDelTable != null)
        //                                        {
        //                                            //找到表
        //                                            var tableData = filterStepDataDelTable.EditFileTableInfos?.FirstOrDefault(t => t.EditFileStepInfoId == item._editFileList[j].StepId && t.TableFieldName == item._editFileList[j].TableFieldName);
        //                                            if (tableData != null)
        //                                            {
        //                                                //大于0 更新
        //                                                editFileTableInfo = new EditFileTableInfo
        //                                                {
        //                                                    Id = Guid.NewGuid(),
        //                                                    EditFileStepInfoId = opertionData.StepId.Value,
        //                                                    FileProcessesId = opertionData.ProcessId.Value.ToString(),
        //                                                    TableFieldName = opertionData.TableFieldName,
        //                                                    TableName = tableFieldName,
        //                                                    //                           UniqueId = opertionData.UniqueId,
        //                                                    NewTable = false,
        //                                                    DeletedTable = true
        //                                                };
        //                                                tableData = editFileTableInfo;
        //                                            }
        //                                            else
        //                                            {
        //                                                //否则新增
        //                                                editFileTableInfo = new EditFileTableInfo
        //                                                {
        //                                                    Id = Guid.NewGuid(),
        //                                                    EditFileStepInfoId = opertionData.StepId.Value,
        //                                                    FileProcessesId = opertionData.ProcessId.Value.ToString(),
        //                                                    TableFieldName = opertionData.TableFieldName,
        //                                                    TableName = tableFieldName,
        //                                                    //  UniqueId = opertionData.UniqueId,
        //                                                    NewTable = false,
        //                                                    DeletedTable = true
        //                                                };
        //                                                table.TableKey = fieldname;
        //                                                table.TableName = tableFieldName;
        //                                                table.FiledDesc = filedMap[table.TableName].filedValue;
        //                                                table.FiledName = filedMap[table.TableName].filedKey;
        //                                                for (int i = 0; i < table.FiledDesc.Count; i++)
        //                                                {
        //                                                    editFileTableStrunctInfo = new EditFileTableStructInfo
        //                                                    {
        //                                                        EditFileTableInfoId = editFileTableInfo.Id,
        //                                                        FieldName = table.FiledDesc[i],
        //                                                        DisplayName = table.FiledName[i],
        //                                                        Index = i,
        //                                                        Show = true
        //                                                    };
        //                                                    editFileTableStrunctInfoList.Add(editFileTableStrunctInfo);
        //                                                }
        //                                                editFileTableInfo.EditFileTableStructInfos = editFileTableStrunctInfoList;

        //                                                if (filterStepDataDelTable.EditFileTableInfos == null)
        //                                                {
        //                                                    filterStepDataDelTable.EditFileTableInfos = new List<EditFileTableInfo>();
        //                                                    filterStepDataDelTable.EditFileTableInfos.Add(editFileTableInfo);
        //                                                }
        //                                                else
        //                                                {
        //                                                    filterStepDataDelTable.EditFileTableInfos.Add(editFileTableInfo);
        //                                                }
        //                                            }
        //                                        }
        //                                        else
        //                                        {
        //                                            var stepNewBool = item._editFileList.Count(t => t.StepId == opertionData.StepId && t.Type == 4);
        //                                            difValue = opertionData.NewValue.Exceptblanks().SplitHtml2().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks().SplitHtml2());
        //                                            if (difValue != "")
        //                                            {
        //                                                //str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
        //                                                //str = opertionData.OldValue + "<ins style='background:#e6ffe6;'><strong>" + difValue + "</strong></ins>";
        //                                                str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
        //                                            }
        //                                            else
        //                                            {
        //                                                str = opertionData.OldValue;
        //                                            }

        //                                            editFileStepInfo = new EditFileStepInfo
        //                                            {
        //                                                Id = opertionData.StepId.Value,
        //                                                EditFileProcessInfoId = opertionData.ProcessId.Value,
        //                                                NewStep = stepNewBool == 0 ? false : true,

        //                                                //                         UniqueId = opertionData.UniqueId,
        //                                                TWorkStepContent = str,
        //                                                WorkStepName = WorkName,
        //                                                WorkStepNumber = currentWork.WorkStepNumber.ToString(),
        //                                                UpdateStepContent = true,
        //                                                WorkStepContent = opertionData.OldValue,
        //                                                WorkStepUpdateContent = opertionData.NewValue,
        //                                                WorkStepWorking = (int)currentWork.WorkStepWorking
        //                                            };
        //                                            editFileTableInfo = new EditFileTableInfo
        //                                            {
        //                                                Id = Guid.NewGuid(),
        //                                                EditFileStepInfoId = opertionData.StepId.Value,
        //                                                FileProcessesId = opertionData.ProcessId.Value.ToString(),
        //                                                TableFieldName = opertionData.TableFieldName,
        //                                                TableName = tableFieldName,
        //                                                //                      UniqueId = opertionData.UniqueId,
        //                                                NewTable = false,
        //                                                DeletedTable = true
        //                                            };
        //                                            table.TableKey = fieldname;
        //                                            table.TableName = tableFieldName;
        //                                            table.FiledDesc = filedMap[table.TableName].filedValue;
        //                                            table.FiledName = filedMap[table.TableName].filedKey;
        //                                            for (int i = 0; i < table.FiledDesc.Count; i++)
        //                                            {
        //                                                editFileTableStrunctInfo = new EditFileTableStructInfo
        //                                                {
        //                                                    EditFileTableInfoId = editFileTableInfo.Id,
        //                                                    FieldName = table.FiledDesc[i],
        //                                                    DisplayName = table.FiledName[i],
        //                                                    Index = i,
        //                                                    Show = true
        //                                                };
        //                                                editFileTableStrunctInfoList.Add(editFileTableStrunctInfo);
        //                                            }

        //                                            //foreach (string str in table.FiledDesc)
        //                                            //{

        //                                            //    foreach (string str2 in table.FiledName)
        //                                            //    {
        //                                            //        editFileTableStrunctInfo = new EditFileTableStructInfo
        //                                            //        {
        //                                            //            FieldName = str,
        //                                            //            DisplayName = str2
        //                                            //        };
        //                                            //        editFileTableStrunctInfoList.Add(editFileTableStrunctInfo);
        //                                            //        break;
        //                                            //    }
        //                                            //}
        //                                            //否则新增
        //                                            //否则新增

        //                                            editFileTableInfo.EditFileTableStructInfos = editFileTableStrunctInfoList;


        //                                            if (editFileStepInfo.EditFileTableInfos == null)
        //                                            {
        //                                                editFileStepInfo.EditFileTableInfos = new List<EditFileTableInfo>();
        //                                                editFileStepInfo.EditFileTableInfos.Add(editFileTableInfo);
        //                                            }
        //                                            else
        //                                            {
        //                                                editFileStepInfo.EditFileTableInfos.Add(editFileTableInfo);
        //                                            }
        //                                            if (filterProcessDelTable.EditFileStepInfos == null)
        //                                            {
        //                                                filterProcessDelTable.EditFileStepInfos = new List<EditFileStepInfo>();
        //                                                filterProcessDelTable.EditFileStepInfos.Add(editFileStepInfo);
        //                                            }
        //                                            else
        //                                            {
        //                                                filterProcessDelTable.EditFileStepInfos.Add(editFileStepInfo);
        //                                            }

        //                                            //editFileTableInfoList.Add(editFileTableInfo);
        //                                            //editFileStepInfo.EditFileTableInfos = editFileTableInfoList;
        //                                            //editFileStepInfoList.Add(editFileStepInfo);
        //                                            //filterProcessDelTable.EditFileStepInfos = editFileStepInfoList;
        //                                        }

        //                                        break;
        //                                    case 7:
        //                                        operationLog.OperationType = OperationTypes.删除工步;

        //                                        var filterProcessDelStep = editFileProcessInfoList.FirstOrDefault(t => t.Id == item._editFileList[j].ProcessId);
        //                                        //filterProcess.EditFileStepInfos = new List<EditFileStepInfo>()
        //                                        //找到工步
        //                                        var filterStepDataDelStep = filterProcessDelStep.EditFileStepInfos?.FirstOrDefault(t => t.Id == item._editFileList[j].StepId);
        //                                        if (filterStepDataDelStep != null)
        //                                        {
        //                                            //大于0 更新
        //                                            //editFileStepInfo = new EditFileStepInfo
        //                                            //{
        //                                            filterStepDataDelStep.Id = opertionData.Id;
        //                                            filterStepDataDelStep.EditFileProcessInfoId = editFileProcessInfoId;
        //                                            filterStepDataDelStep.NewStep = false;
        //                                            filterStepDataDelStep.DeletedStep = true;
        //                                            //                      filterStepDataDelStep.UniqueId = opertionData.UniqueId;
        //                                            filterStepDataDelStep.TWorkStepContent = opertionData.NewValue;
        //                                            filterStepDataDelStep.WorkStepName = WorkName;
        //                                            filterStepDataDelStep.WorkStepNumber = currentWork?.WorkStepNumber.ToString();
        //                                            filterStepDataDelStep.UpdateStepContent = true;
        //                                            filterStepDataDelStep.WorkStepContent = opertionData.OldValue;
        //                                            filterStepDataDelStep.WorkStepUpdateContent = opertionData.NewValue;
        //                                            filterStepDataDelStep.WorkStepWorking = currentWork == null ? 0 : (int)currentWork.WorkStepWorking;
        //                                            //};
        //                                            //filterStepDataMs = editFileStepInfo;
        //                                        }
        //                                        else
        //                                        {
        //                                            editFileStepInfo = new EditFileStepInfo
        //                                            {
        //                                                Id = opertionData.StepId.Value,
        //                                                EditFileProcessInfoId = opertionData.ProcessId.Value,
        //                                                NewStep = false,
        //                                                DeletedStep = true,
        //                                                //                       UniqueId = opertionData.UniqueId,
        //                                                TWorkStepContent = opertionData.NewValue,
        //                                                WorkStepName = WorkName,
        //                                                WorkStepNumber = currentWork?.WorkStepNumber.ToString(),
        //                                                UpdateStepContent = true,
        //                                                WorkStepContent = opertionData.OldValue,
        //                                                WorkStepUpdateContent = opertionData.NewValue,
        //                                                WorkStepWorking = currentWork == null ? 0 : (int)currentWork.WorkStepWorking
        //                                            };
        //                                            filterProcessDelStep.EditFileStepInfos.Add(editFileStepInfo);
        //                                        }
        //                                        break;
        //                                    case 8:
        //                                        operationLog.OperationType = OperationTypes.编辑工序描述;
        //                                        if (string.IsNullOrEmpty(opertionData.StepId.ToString()))
        //                                        {
        //                                            var filterProcessAdd = editFileProcessInfoList.FirstOrDefault(t => t.Id == item._editFileList[j].ProcessId);

        //                                            if (filterProcessAdd != null)
        //                                            {
        //                                                difValue = opertionData.NewValue.Exceptblanks().SplitHtml2().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks().SplitHtml2());
        //                                                if (difValue != "")
        //                                                {
        //                                                    //str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
        //                                                    //str = opertionData.OldValue + "<ins style='background:#e6ffe6;'><strong>" + difValue + "</strong></ins>";
        //                                                    str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
        //                                                }
        //                                                else
        //                                                {
        //                                                    str = opertionData.OldValue;
        //                                                }


        //                                                //var processData = ReturnBopTaskOutDto.TechniqueTask.ProcessesListDto.Where(d => d.Id == editFileProcessInfoId).FirstOrDefault();
        //                                                var processData = item._editFileList.FirstOrDefault(t => t.ProcessId == opertionData.ProcessId && t.StepId == null);
        //                                                if (processData != null)
        //                                                {

        //                                                    filterProcessAdd.ProcessesName = currentPro.ProcessesName.ToString();
        //                                                    filterProcessAdd.ProcessesSequence = currentPro.ProcessesSequence;
        //                                                    filterProcessAdd.ProcessesCharacteristic = currentPro.ProcessesCharacteristic;
        //                                                    filterProcessAdd.ProcessesExplain = processData.OldValue;
        //                                                    filterProcessAdd.UpdateProcessesExplain = str;
        //                                                    filterProcessAdd.UpdateProcessContent = true;
        //                                                    //editFileProcessInfoList.Add(editFileProcessInfo);
        //                                                }
        //                                                //editFileProcessInfo.EditFileStepInfos = editFileStepInfoList;
        //                                            }
        //                                        }
        //                                        //else
        //                                        //{
        //                                        //    if (editFileProcessInfoList.Count == 0)
        //                                        //    {
        //                                        //        editFileProcessInfo = new EditFileProcessInfo
        //                                        //        {
        //                                        //            Id = currentPro.Id,
        //                                        //            EditFileProcessId = currentPro.Id,
        //                                        //            UniqueId = item._editFileList[j].UniqueId,
        //                                        //            ProcessesName = currentPro.ProcessesSequence.ToString(),
        //                                        //            ProcessesSequence = currentPro.ProcessesSequence,
        //                                        //            ProcessesCharacteristic = currentPro.ProcessesCharacteristic,
        //                                        //            ProcessesExplain = currentPro.ProcessesExplain,
        //                                        //            UpdateProcessesExplain = "",
        //                                        //            UpdateProcessContent = false
        //                                        //        };
        //                                        //        editFileProcessInfo.EditFileStepInfos = editFileStepInfoList;
        //                                        //        editFileProcessInfoList.Add(editFileProcessInfo);
        //                                        //    }

        //                                        //}

        //                                        break;
        //                                    case 9:
        //                                        operationLog.OperationType = OperationTypes.编辑文件描述;
        //                                        break;
        //                                    case 10:
        //                                        operationLog.OperationType = OperationTypes.编辑是否多媒体;
        //                                        break;
        //                                    default:
        //                                        operationLog.OperationType = OperationTypes.默认修改;
        //                                        break;
        //                                }
        //                                //  _operationHistoryRepository.Insert(operationLog);
        //                            }
        //                            item.Id = Guid.NewGuid();
        //                            item.EditFileProcessInfos = editFileProcessInfoList;
        //                            _editFileProcessRepository.Insert(item);
        //                        }

        //                        //   }
        //                    }
        //                    //if (ReturnBopTaskOutDto._editFileList != null)
        //                    //{
        //                    //    User users;
        //                    //    foreach (var item in ReturnBopTaskOutDto._editFileList)
        //                    //    {
        //                    //        deleteEditFile(item.FileProcessSpecificationId);
        //                    //        //这样传入返回新的Techid 就可以查出所有信息
        //                    //        item.RTechniqueEntityId = techniqueReturnId;
        //                    //        //根据用户名获取用户Id
        //                    //        if (item.CreatorUserName != null)
        //                    //        {
        //                    //            users = userList.FirstOrDefault(s => s.UserName == item.CreatorUserName);
        //                    //            item.CreatorUserId = users.Id;
        //                    //        }
        //                    //        item.Id = Guid.NewGuid();
        //                    //        _editFileProcessRepository.Insert(item);
        //                    //        OperationLog tempLog = new OperationLog();
        //                    //        tempLog.BusinessId = techniqueList.TechniqueEntityId;
        //                    //        tempLog.BusinessType = BusinessTypes.Bop质量变更记录;
        //                    //        tempLog.OperationType = OperationTypes.默认修改;
        //                    //        tempLog.Content = DateTime.Now.ToShortDateString() + "回传版本" + item._editVersion;
        //                    //        _operationHistoryRepository.Insert(tempLog);
        //                    //        item._editFileList = item._editFileList.OrderBy(d => d.CreationTime).ToList();
        //                    //        for (int j = 0; j < item._editFileList.Count; j++)
        //                    //        {
        //                    //            string techName = "";
        //                    //            item._editFileList[j].Id = Guid.NewGuid();
        //                    //            var currentPro = ReturnBopTaskOutDto.TechniqueTask.ProcessesListDto.Where(d => d.Id == item._editFileList[j].ProcessId.Value).FirstOrDefault();
        //                    //            WorkStepReturnDto currentWork = new WorkStepReturnDto();
        //                    //            if (currentPro != null)
        //                    //            {
        //                    //                if (item._editFileList[j].StepId != null)
        //                    //                {
        //                    //                    currentWork = currentPro.WorkStepListDto.Where(d => d.Id == item._editFileList[j].StepId.Value).FirstOrDefault();
        //                    //                }
        //                    //            }
        //                    //            TableNameDictionary dic = new TableNameDictionary();

        //                    //            string tableFieldName = "";
        //                    //            string fieldname = "";
        //                    //            string ProName = "";
        //                    //            string WorkName = "";
        //                    //            if (currentPro != null)
        //                    //            {
        //                    //                ProName = "工序" + currentPro.ProcessesSequence.ToString();
        //                    //            }
        //                    //            if (currentWork != null)
        //                    //            {
        //                    //                WorkName = "工步" + currentWork.WorkStepNumber.ToString();
        //                    //            }
        //                    //            foreach (KeyValuePair<string, FiledNodeMap> kvp in filedMap)
        //                    //            {
        //                    //                string tempStr = item._editFileList[j].TableFieldName;
        //                    //                if (!string.IsNullOrEmpty(tempStr))
        //                    //                {
        //                    //                    if (kvp.Value.filedNodeDto.ToLower() == tempStr.ToLower())
        //                    //                    {
        //                    //                        tableFieldName = kvp.Key;
        //                    //                        int index = kvp.Value.filedValue.IndexOf(char.ToLower(tempStr[0]) + tempStr.Substring(1));
        //                    //                        if (index != -1)
        //                    //                        {
        //                    //                            fieldname = kvp.Value.filedKey[index];
        //                    //                        }
        //                    //                    }
        //                    //                }
        //                    //            }
        //                    //            OperationLog operationLog = new OperationLog();
        //                    //            operationLog.BusinessId = techniqueList.Id;
        //                    //            operationLog.BusinessType = BusinessTypes.Bop质量变更记录;
        //                    //            if (item._editFileList[j].CreatorUserId != null)
        //                    //            {
        //                    //                string userName = "";
        //                    //                var user = _userRepository.FirstOrDefault(d => d.Id == item._editFileList[j].CreatorUserId.Value);
        //                    //                if (user != null)
        //                    //                {
        //                    //                    userName = user.Surname + user.Name;
        //                    //                    operationLog.UserName = userName;
        //                    //                }
        //                    //                operationLog.UserId = item._editFileList[j].CreatorUserId.Value;
        //                    //            }
        //                    //            switch (item._editFileList[j].Type)
        //                    //            {
        //                    //                case 0:
        //                    //                    operationLog.OperationType = OperationTypes.编辑表格内容;
        //                    //                    operationLog.Content = ProName + "-" + WorkName + tableFieldName + "编辑表格内容" + fieldname + ",原数据为:" + item._editFileList[j].OldValue + "修改为：" + item._editFileList[j].NewValue;
        //                    //                    break;
        //                    //                case 1:
        //                    //                    operationLog.OperationType = OperationTypes.批量编辑表格内容;
        //                    //                    operationLog.Content = ProName + "-" + WorkName + tableFieldName + "批量编辑表格内容" + fieldname + ",原数据为:" + item._editFileList[j].OldValue + "修改为：" + item._editFileList[j].NewValue;
        //                    //                    break;
        //                    //                case 2:
        //                    //                    operationLog.OperationType = OperationTypes.表格添加行;
        //                    //                    operationLog.Content = ProName + "-" + WorkName + tableFieldName + "表格添加行" + fieldname + ",添加数据为:" + item._editFileList[j].NewValue;
        //                    //                    break;
        //                    //                case 3:
        //                    //                    operationLog.OperationType = OperationTypes.添加表;
        //                    //                    operationLog.Content = ProName + "-" + WorkName + ",添加表:" + tableFieldName;
        //                    //                    break;
        //                    //                case 4:
        //                    //                    operationLog.OperationType = OperationTypes.编辑工步描述;
        //                    //                    operationLog.Content = ProName + "编辑工步描述" + WorkName + ",原工步描述:" + item._editFileList[j].OldValue + "修改为：" + item._editFileList[j].NewValue;
        //                    //                    break;
        //                    //                case 5:
        //                    //                    operationLog.OperationType = OperationTypes.新增工步;
        //                    //                    operationLog.Content = ProName + "新增工步" + WorkName;
        //                    //                    break;
        //                    //                case 6:
        //                    //                    operationLog.OperationType = OperationTypes.表格删除行;
        //                    //                    operationLog.Content = ProName + "-" + WorkName + tableFieldName + "表格删除行" + fieldname + ",删除数据为:" + item._editFileList[j].NewValue;
        //                    //                    break;
        //                    //                case 7:
        //                    //                    operationLog.OperationType = OperationTypes.删除表;
        //                    //                    operationLog.Content = ProName + "-" + WorkName + ",删除表:" + tableFieldName;
        //                    //                    break;
        //                    //                case 8:
        //                    //                    operationLog.OperationType = OperationTypes.删除工步;
        //                    //                    operationLog.Content = ProName + "删除工步" + WorkName;
        //                    //                    break;
        //                    //                case 9:
        //                    //                    operationLog.OperationType = OperationTypes.编辑状态下编辑表格内容;
        //                    //                    operationLog.Content = "编辑状态下编辑表格内容:" + fieldname + ",原数据为:" + item._editFileList[j].OldValue + "修改为：" + item._editFileList[j].NewValue;
        //                    //                    break;
        //                    //                case 10:
        //                    //                    operationLog.OperationType = OperationTypes.编辑状态下批量编辑表格内容;
        //                    //                    operationLog.Content = "编辑状态下批量编辑表格内容:" + fieldname + ",原数据为:" + item._editFileList[j].OldValue + "修改为：" + item._editFileList[j].NewValue;
        //                    //                    break;
        //                    //                case 11:
        //                    //                    operationLog.OperationType = OperationTypes.编辑现场异常记录;
        //                    //                    operationLog.Content = ProName + "-" + WorkName + tableFieldName + "编辑现场异常记录";
        //                    //                    break;
        //                    //                case 12:
        //                    //                    operationLog.OperationType = OperationTypes.打开文件;
        //                    //                    operationLog.Content = "打开文件";
        //                    //                    break;
        //                    //                case 13:
        //                    //                    operationLog.OperationType = OperationTypes.锁定行;
        //                    //                    operationLog.Content = ProName + "-" + WorkName + item._editFileList[j].TableFieldName + "锁定行";
        //                    //                    break;
        //                    //                case 14:
        //                    //                    operationLog.OperationType = OperationTypes.解除锁定行;
        //                    //                    operationLog.Content = ProName + "-" + WorkName + item._editFileList[j].TableFieldName + "解除锁定行";
        //                    //                    break;
        //                    //                case 15:
        //                    //                    operationLog.OperationType = OperationTypes.锁定工步;
        //                    //                    operationLog.Content = ProName + "锁定工步" + WorkName;
        //                    //                    break;
        //                    //                case 16:
        //                    //                    operationLog.OperationType = OperationTypes.解除锁定工步;
        //                    //                    operationLog.Content = ProName + "解除锁定工步" + WorkName;
        //                    //                    break;
        //                    //                case 17:
        //                    //                    operationLog.OperationType = OperationTypes.取消三检;
        //                    //                    operationLog.Content = ProName + "-" + WorkName + item._editFileList[j].TableFieldName + "取消三检";
        //                    //                    break;
        //                    //                case 18:
        //                    //                    operationLog.OperationType = OperationTypes.升版;
        //                    //                    operationLog.Content = ReturnBopTaskOutDto.TechniqueTask.TechniqueNumber + "升版";
        //                    //                    break;
        //                    //                default:
        //                    //                    operationLog.OperationType = OperationTypes.默认修改;
        //                    //                    operationLog.Content = ProName + "默认修改";
        //                    //                    break;
        //                    //            }
        //                    //            _operationHistoryRepository.Insert(operationLog);
        //                    //        }
        //                    //    }
        //                    //}
        //                    if (ReturnBopTaskOutDto.fileProcessOperationLogs != null)
        //                    {
        //                        ReturnBopTaskOutDto.fileProcessOperationLogs = ReturnBopTaskOutDto.fileProcessOperationLogs.OrderBy(d => d.creationTime).ToList();
        //                        for (int j = 0; j < ReturnBopTaskOutDto.fileProcessOperationLogs.Count; j++)
        //                        {
        //                            var currentPro = ReturnBopTaskOutDto.TechniqueTask.ProcessesListDto.FirstOrDefault(d => d.Id == ReturnBopTaskOutDto.fileProcessOperationLogs[j].processId);
        //                            WorkStepReturnDto currentWork = new WorkStepReturnDto();
        //                            if (currentPro != null)
        //                            {
        //                                currentWork = currentPro.WorkStepListDto.FirstOrDefault(d => d.Id == ReturnBopTaskOutDto.fileProcessOperationLogs[j].stepId);
        //                            }
        //                            TableNameDictionary dic = new TableNameDictionary();
        //                            string tableFieldName = ReturnBopTaskOutDto.fileProcessOperationLogs[j].tableDisplayName;
        //                            string fieldname = ReturnBopTaskOutDto.fileProcessOperationLogs[j].fieldDisplayName;
        //                            string ProName = "";
        //                            string WorkName = "";
        //                            if (currentPro != null)
        //                            {
        //                                ProName = "工序" + currentPro.ProcessesSequence.ToString();
        //                            }
        //                            if (currentWork != null)
        //                            {
        //                                WorkName = "工步" + currentWork.WorkStepNumber.ToString();
        //                            }
        //                            //foreach (KeyValuePair<string, FiledNodeMap> kvp in filedMap)
        //                            //{
        //                            //    string tempStr = ReturnBopTaskOutDto.fileProcessOperationLogs[j].tableFieldName;
        //                            //    if (!string.IsNullOrEmpty(tempStr))
        //                            //    {
        //                            //        if (kvp.Value.filedNodeDto.ToLower() == tempStr.ToLower())
        //                            //        {
        //                            //            tableFieldName = kvp.Key;
        //                            //            int index = kvp.Value.filedValue.IndexOf(char.ToLower(tempStr[0]) + tempStr.Substring(1));
        //                            //            if (index != -1)
        //                            //            {
        //                            //                fieldname = kvp.Value.filedKey[index];
        //                            //            }
        //                            //        }
        //                            //    }
        //                            //}
        //                            OperationLog operationLog = new OperationLog();
        //                            operationLog.BusinessId = techniqueList.Id;
        //                            operationLog.BusinessType = BusinessTypes.Bop质量执行记录;
        //                            if (ReturnBopTaskOutDto.fileProcessOperationLogs[j].creatorUserId != null)
        //                            {
        //                                string userName = "";
        //                                user = userList.FirstOrDefault(d => d.Id == ReturnBopTaskOutDto.fileProcessOperationLogs[j].creatorUserId.Value);
        //                                if (user != null)
        //                                {
        //                                    userName = user.Surname + user.Name;
        //                                    operationLog.UserName = userName;
        //                                }
        //                                operationLog.UserId = ReturnBopTaskOutDto.fileProcessOperationLogs[j].creatorUserId;
        //                            }

        //                            switch (ReturnBopTaskOutDto.fileProcessOperationLogs[j].type)
        //                            {
        //                                case 0:
        //                                    operationLog.OperationType = OperationTypes.编辑表格内容;
        //                                    operationLog.Content = ProName + "-" + WorkName + tableFieldName + "编辑表格内容" + fieldname + ",原数据为:" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].oldValue + "修改为：" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].newValue;
        //                                    break;
        //                                case 1:
        //                                    operationLog.OperationType = OperationTypes.表格添加行;
        //                                    operationLog.Content = ProName + "-" + WorkName + tableFieldName + "表格添加行" + fieldname + ",添加数据为:" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].newValue;
        //                                    break;
        //                                case 2:
        //                                    operationLog.OperationType = OperationTypes.添加表;
        //                                    operationLog.Content = ProName + "-" + WorkName + ",添加表:" + tableFieldName;
        //                                    break;
        //                                case 3:
        //                                    operationLog.OperationType = OperationTypes.编辑工步描述;
        //                                    operationLog.Content = ProName + "编辑工步描述" + WorkName + ",原工步描述:" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].oldValue + "修改为：" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].newValue;
        //                                    break;
        //                                case 4:
        //                                    operationLog.OperationType = OperationTypes.新增工步;
        //                                    operationLog.Content = ProName + "新增工步" + WorkName;
        //                                    break;
        //                                case 5:
        //                                    operationLog.OperationType = OperationTypes.表格删除行;
        //                                    operationLog.Content = ProName + "-" + WorkName + tableFieldName + "表格删除行" + fieldname + ",删除数据为:" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].newValue;
        //                                    break;
        //                                case 6:
        //                                    operationLog.OperationType = OperationTypes.删除表;
        //                                    operationLog.Content = ProName + "-" + WorkName + ",删除表:" + tableFieldName;
        //                                    break;
        //                                case 7:
        //                                    operationLog.OperationType = OperationTypes.删除工步;
        //                                    operationLog.Content = ProName + "删除工步" + WorkName;
        //                                    break;
        //                                case 8:
        //                                    operationLog.OperationType = OperationTypes.编辑状态下编辑表格内容;
        //                                    operationLog.Content = "编辑状态下编辑表格内容:" + fieldname + ",原数据为:" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].oldValue + "修改为：" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].newValue;
        //                                    break;
        //                                case 9:
        //                                    operationLog.OperationType = OperationTypes.编辑状态下批量编辑表格内容;
        //                                    operationLog.Content = "编辑状态下批量编辑表格内容:" + fieldname + ",原数据为:" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].oldValue + "修改为：" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].newValue;
        //                                    break;
        //                                case 10:
        //                                    operationLog.OperationType = OperationTypes.编辑现场异常记录;
        //                                    operationLog.Content = ProName + "-" + WorkName + tableFieldName + "编辑现场异常记录";
        //                                    break;
        //                                case 11:
        //                                    operationLog.OperationType = OperationTypes.打开文件;
        //                                    operationLog.Content = "打开文件";
        //                                    break;
        //                                case 12:
        //                                    operationLog.OperationType = OperationTypes.锁定行;
        //                                    operationLog.Content = ProName + "-" + WorkName + ReturnBopTaskOutDto.fileProcessOperationLogs[j].tableDisplayName + "锁定行";
        //                                    break;
        //                                case 13:
        //                                    operationLog.OperationType = OperationTypes.解除锁定行;
        //                                    operationLog.Content = ProName + "-" + WorkName + ReturnBopTaskOutDto.fileProcessOperationLogs[j].tableDisplayName + "解除锁定行";
        //                                    break;
        //                                case 14:
        //                                    operationLog.OperationType = OperationTypes.锁定工步;
        //                                    operationLog.Content = ProName + "锁定工步" + WorkName;
        //                                    break;
        //                                case 15:
        //                                    operationLog.OperationType = OperationTypes.解除锁定工步;
        //                                    operationLog.Content = ProName + "解除锁定工步" + WorkName;
        //                                    break;
        //                                case 16:
        //                                    operationLog.OperationType = OperationTypes.取消三检;
        //                                    operationLog.Content = ProName + "-" + WorkName + ReturnBopTaskOutDto.fileProcessOperationLogs[j].tableDisplayName + "取消三检";
        //                                    break;
        //                                case 17:
        //                                    operationLog.OperationType = OperationTypes.升版;
        //                                    operationLog.Content = ReturnBopTaskOutDto.TechniqueTask.TechniqueNumber + "升版";
        //                                    break;
        //                                default:
        //                                    operationLog.OperationType = OperationTypes.默认修改;
        //                                    operationLog.Content = ProName + "默认修改";
        //                                    break;
        //                            }
        //                            _operationHistoryRepository.Insert(operationLog);
        //                        }
        //                    }
        //                    if (ReturnBopTaskOutDto.ClearSignatureRecord != null)
        //                    {
        //                        foreach (var item in ReturnBopTaskOutDto.ClearSignatureRecord)
        //                        {
        //                            var guida = item.FileId.ToString().ToUpper();

        //                            deleteClearSignatureRecord(Guid.Parse(guida));
        //                            item.RTechniqueEntityId = techniqueReturnId;
        //                            //item.CreatorUserId = userList.FirstOrDefault(s => s.UserName == item.CreatorUserName).Id;
        //                            user = userList.FirstOrDefault(s => s.UserName == item.CreatorUserName);
        //                            if (user != null)
        //                            {
        //                                item.CreatorUserId = user.Id;
        //                            }
        //                            _clearSignatureRecordRepository.Insert(item);
        //                        }
        //                    }
        //                    return "true";
        //                }
        //                catch (Exception ex)
        //                {
        //                    message = ex.ToString();
        //                    return message;
        //                }
        //            }
        //        }
        //    }
        //    return "";



        //    //var dto = await _rTechniqueEntityRepository.FirstOrDefaultAsync(c => c.TechniqueNumber == techniqueNum);
        //    //if (dto != null)
        //    //{
        //    //    throw new UserFriendlyException("当前系统中已存在" + techniqueNum + "的相应信息！");
        //    //}
        //    ////string filepath = @"F:\GCdrawingnumS112001Z2.json";
        //    //try
        //    //{
        //    //    var jsonStr = ReadJson.GetFileJson(filepath);
        //    //    var ReturnBopTaskOutDto = JsonConvert.DeserializeObject<ReturnBopTaskOutDto>(jsonStr);

        //    //    var techniqueList = ObjectMapper.Map<RTechniqueEntity>(ReturnBopTaskOutDto.TechniqueTask);
        //    //    techniqueList.Id = Guid.NewGuid();
        //    //    techniqueList.TechniqueEntityId = ReturnBopTaskOutDto.TechniqueTask.Id;
        //    //    techniqueList.LotNo = ReturnBopTaskOutDto.LotNo;
        //    //    techniqueList.Model = ReturnBopTaskOutDto.Model;
        //    //    techniqueList.ProcessesEntities = new List<RProcessesEntity>();

        //    //    //工艺文件，工序，工步， 表
        //    //    var techniqueReturnId = await InsertAll(ReturnBopTaskOutDto.TechniqueTask, techniqueList);
        //    //    //接口传
        //    //    _ibopNodeAppService.UpdateReturnStatus(ReturnBopTaskOutDto.TechniqueTask.BopNodeId, techniqueList.Id);
        //    //}
        //    //catch (Exception e)
        //    //{
        //    //    throw e;
        //    //}

        //}




        /// <summary>
        /// 返回json文件入库
        /// </summary>
        /// <param name="filepath"></param>
        /// <returns></returns>
        [AllowAnonymous]
        public async Task<string> AnalysisReturnJson(string filepath, string techniqueNum)
        {
            Guid editFileProcessInfoId = Guid.Empty;
            string message = "";
            //获取所有用户
            var userList = _userRepository.GetAll();
            try
            {
                var jsonStr = ReadJson.GetFileJson(filepath);

                Guid guidTech = Guid.Empty;
                var ReturnBopTaskOutDto = JsonConvert.DeserializeObject<ReturnBopTaskOutDto>(jsonStr);
                
                if (ReturnBopTaskOutDto.TechniqueTask != null)
                {
                    #region 2021 10 18 Edit by DaoBen 
                    //根据规程id找出规程 如果存在清除相关表数据
                    var tempTech = await _rTechniqueEntityRepository.FirstOrDefaultAsync(c => c.TechniqueEntityId == ReturnBopTaskOutDto.TechniqueTask.Id);
                    if (tempTech != null)
                    {
                        //using (var unitofwork = _unitOfWorkManager.Begin(System.Transactions.TransactionScopeOption.RequiresNew))
                        //{
                        //    await _rTechniqueEntityRepository.HardDeleteAsync(d => d.Id == tempTech.Id);
                        //    _unitOfWorkManager.Current.SaveChanges();
                        //    unitofwork.Complete();
                        //}
                        await _rTechniqueEntityRepository.HardDeleteAsync(d => d.Id == tempTech.Id);
                        _unitOfWorkManager.Current.SaveChanges();
                        //await _RprocessesRepository.DeleteAsync(d => d.RTechniqueEntityId == tempTech.Id);
                        //var tempWorkList = (from temp1 in _RWorkStepRepository.GetAll().Where(d => d.RTechniqueEntityId == tempTech.Id)
                        //                    join temp2 in _rTableBaseEntity.GetAllIncluding(a => a.RecordRequirements, b => b.InspectionSignature, c => c.MeasuredResult, d => d.Environment, e => e.MultiMedia) on temp1.Id equals temp2.RWorkStepEntityId
                        //                    select temp2).ToList();
                        //var tempLoadList = (from temp1 in _RWorkStepRepository.GetAll().Where(d => d.RTechniqueEntityId == tempTech.Id)
                        //                    join temp2 in _loadPieceRepository.GetAll() on temp1.Id equals temp2.RWorkStepEntityId
                        //                    select temp2).ToList();
                        //var tempMakeList = (from temp1 in _RWorkStepRepository.GetAll().Where(d => d.RTechniqueEntityId == tempTech.Id)
                        //                    join temp2 in _makeResourcesEntityRepository.GetAll() on temp1.Id equals temp2.RWorkStepEntityId
                        //                    select temp2).ToList();
                        //var tempVideoList = (from temp1 in _RWorkStepRepository.GetAll().Where(d => d.RTechniqueEntityId == tempTech.Id)
                        //                     join temp2 in _videoEntityRepository.GetAll() on temp1.Id equals temp2.RWorkStepEntityId
                        //                     select temp2).ToList();

                        //await _RWorkStepRepository.DeleteAsync(d => d.RTechniqueEntityId == tempTech.Id);
                        //foreach (var item in tempWorkList)
                        //{
                        //    await _rTableBaseEntity.DeleteAsync(item);
                        //}
                        //foreach (var item in tempLoadList)
                        //{
                        //    await _loadPieceRepository.DeleteAsync(item);
                        //}
                        //foreach (var item in tempMakeList)
                        //{
                        //    await _makeResourcesEntityRepository.DeleteAsync(item);
                        //}
                        //foreach (var item in tempVideoList)
                        //{
                        //    await _videoEntityRepository.DeleteAsync(item);
                        //}
                    }

                    #endregion
                }
                Guid oldTechiId = Guid.Empty;
                int version = 0;
                List<EditFileProcess> editFileProcessList = new List<EditFileProcess>();
                if (ReturnBopTaskOutDto._editFileList != null) 
                {
                    editFileProcessList = ReturnBopTaskOutDto._editFileList.OrderByDescending(t => int.Parse(t._editVersion)).ToList();
                    version = int.Parse(editFileProcessList.First()._editVersion);
                }
                //if (version > 1)
                //{
                //    //如果版本大于1 存在原techid
                //    oldTechiId = _editFileProcessRepository.FirstOrDefault(t => t.FileProcessSpecificationId == ReturnBopTaskOutDto.Id && t._editVersion == "1").RTechniqueEntityId.Value;
                //}
                //
                var techniqueList = ObjectMapper.Map<RTechniqueEntity>(ReturnBopTaskOutDto.TechniqueTask);
                techniqueList.Id =Guid.NewGuid();
                techniqueList.TechniqueEntityId = ReturnBopTaskOutDto.TechniqueTask.Id;
                techniqueList.LotNo = ReturnBopTaskOutDto.LotNo;
                techniqueList.Model = ReturnBopTaskOutDto.Model;
                techniqueList.ProcessesEntities = new List<RProcessesEntity>();
                
                //工艺文件，工序，工步， 表
                var techniqueReturnId = await InsertAll_BC(ReturnBopTaskOutDto.TechniqueTask, techniqueList);
                _ibopNodeAppService.UpdateReturnStatus(ReturnBopTaskOutDto.TechniqueTask.BopNodeId, techniqueList.Id);

                Common.TableMapConfig tableMapConfig = new Common.TableMapConfig();
                Dictionary<string, FiledNodeMap> filedMap = tableMapConfig.InitFiledNodeMap();
                User user;
                var bopNodeFirst = _bopNodeRepository.FirstOrDefault(d => d.TechniqueEntityId == techniqueList.TechniqueEntityId);
                var nodeDescId = bopNodeFirst.BopDescId;
                var bopDesc = _bopDescRepository.FirstOrDefault(d => d.Id == nodeDescId);
                if (ReturnBopTaskOutDto._editFileList != null)
                {
                    try
                    {
                        //var editFileProcess = ReturnBopTaskOutDto._editFileList.Where(t => t._editVersion == version);
                        foreach (var item in editFileProcessList)
                        {
                            
                            deleteEditFile(ReturnBopTaskOutDto.Id, item._editVersion);
                            //这样传入返回新的Techid 就可以查出所有信息
                            item.RTechniqueEntityId = techniqueReturnId;
                            item.FileProcessSpecificationId = ReturnBopTaskOutDto.Id;
                            //根据用户名获取用户Id
                            user = userList.FirstOrDefault(s => s.UserName == item.CreatorUserName);
                            if (user != null)
                            {
                                item.CreatorUserId = user.Id;
                            }

                            //CurrentUnitOfWork.SaveChanges();
                            OperationLog tempLog = new OperationLog();
                            tempLog.BusinessId = techniqueList.TechniqueEntityId;
                            tempLog.BusinessType = BusinessTypes.Bop质量变更记录;
                            tempLog.OperationType = OperationTypes.默认修改;
                            tempLog.Content = DateTime.Now.ToShortDateString() + "回传版本" + item._editVersion;
                            if (user != null)
                            {
                                tempLog.CreatorUserId = user.Id;
                            }
                            _operationHistoryRepository.Insert(tempLog);

                            var pphr = item._editFileList.OrderByDescending(t => t.CreateTime).ToList();
                            for (int j =0; j<pphr.Count();j++)
                            {
                                RtableNameDictionary table = new RtableNameDictionary();
                                var currentPro = ReturnBopTaskOutDto.TechniqueTask.ProcessesListDto.Where(d => d.Id == item._editFileList[j].ProcessId).FirstOrDefault();
                                string techName = "";
                                WorkStepReturnDto currentWork = new WorkStepReturnDto();
                                if (currentPro != null)
                                {
                                    if (item._editFileList[j].StepId != null)
                                    {
                                        currentWork = currentPro.WorkStepListDto.Where(d => d.Id == item._editFileList[j].StepId).FirstOrDefault();
                                    }
                                }
                                string tableFieldName = "";
                                string fieldname = "";
                                string ProName = "";
                                string WorkName = "";
                                if (currentPro != null)
                                {

                                    ProName = "工序" + currentPro.ProcessesName.ToString();

                                    var isExistProcess = editFileProcessInfoList.Count(t => t.EditFileProcessId == currentPro.Id);
                                    if (isExistProcess == 0)
                                    {
                                        //
                                        if (currentWork == null)
                                        {
                                            editFileProcessInfo = new EditFileProcessInfo
                                            {
                                                //  Id = item._editFileList[j].ProcessId.Value,
                                                Id = Guid.NewGuid(),
                                                EditFileProcessId = item._editFileList[j].ProcessId.Value,
                                                UniqueId = item._editFileList[j].UniqueId,
                                                ProcessesName = currentPro.ProcessesName.ToString(),
                                                ProcessesSequence = currentPro.ProcessesSequence,
                                                ProcessesCharacteristic = currentPro.ProcessesCharacteristic,
                                                ProcessesExplain = item._editFileList[j].OldValue,
                                                UpdateProcessesExplain = item._editFileList[j].NewValue,
                                                UpdateProcessContent = true,
                                                // CreatorUserId = user.Id
                                            };
                                            // editFileProcessInfo.EditFileStepInfos = editFileStepInfoList;
                                            editFileProcessInfoList.Add(editFileProcessInfo);
                                        }
                                        else
                                        {
                                            editFileProcessInfo = new EditFileProcessInfo
                                            {
                                                Id = Guid.NewGuid(),
                                                EditFileProcessId = currentPro.Id,
                                                UniqueId = item._editFileList[j].UniqueId,
                                                ProcessesName = currentPro.ProcessesName.ToString(),
                                                ProcessesSequence = currentPro.ProcessesSequence,
                                                ProcessesCharacteristic = currentPro.ProcessesCharacteristic,
                                                ProcessesExplain = currentPro.ProcessesExplain,
                                                UpdateProcessesExplain = "",
                                                UpdateProcessContent = false,
                                                //CreatorUserId = user.Id
                                            };
                                            //editFileProcessInfo.EditFileStepInfos = currentWork;
                                            editFileProcessInfoList.Add(editFileProcessInfo);
                                        }
                                    }
                                }
                                var queryStepEntity = _RWorkStepRepository.FirstOrDefault(t => t.Id == item._editFileList[j].StepId);
                           
                                if (currentWork != null)
                                {
                                    WorkName = "工步" + currentWork.WorkStepNumber.ToString();
                                }
                                else 
                                {
                                    if (queryStepEntity != null)
                                    {
                                        WorkName = "工步" + queryStepEntity.WorkStepNumber.ToString();
                                    }
                                
                                }
                                foreach (KeyValuePair<string, FiledNodeMap> kvp in filedMap)
                                {
                                    string tempStr = item._editFileList[j].TableFieldName;
                                    if (!string.IsNullOrEmpty(tempStr))
                                    {
                                        if (kvp.Value.filedNodeDto.ToLower() == tempStr.ToLower())
                                        {
                                            tableFieldName = kvp.Key;
                                            int index = kvp.Value.filedValue.IndexOf(char.ToLower(tempStr[0]) + tempStr.Substring(1));
                                            if (index != -1)
                                            {
                                                fieldname = kvp.Value.filedKey[index];
                                            }
                                        }
                                    }
                                }
                                OperationLog operationLog = new OperationLog();
                                //  operationLog.BusinessId = techniqueList.Id;
                                operationLog.BusinessType = BusinessTypes.Bop质量变更记录;
                                if (item._editFileList[j].CreatorUserName != null)
                                {
                                    string userName = "";
                                    user = userList.FirstOrDefault(s => s.UserName == item._editFileList[j].CreatorUserName);
                                    if (user != null)
                                    {
                                        userName = user.Surname + user.Name;
                                        operationLog.UserName = userName;
                                        operationLog.UserId = user.Id;
                                    }
                                }

                                var opertionData = item._editFileList[j];
                                string str = "";
                                string difValue = "";
                                switch (opertionData.Type)
                                {
                                    case 0:
                                        operationLog.OperationType = OperationTypes.编辑表格内容;

                                        editFileRowInfolist = new List<EditFileRowInfo>();
                                        // editFileTableDataInfoList = new List<EditFileTableDataInfo>();
                                        editFileTableStrunctInfoList = new List<EditFileTableStructInfo>();
                                        var filterProcessAddTableRowContent = editFileProcessInfoList.FirstOrDefault(t => t.EditFileProcessId == opertionData.ProcessId);
                                        var propertyInfo = currentWork.GetType().GetProperty(opertionData.TableFieldName);
                                        object value = propertyInfo.GetValue(currentWork, null);
                                        dynamic dica = default;
                                        //先根据rowid并且 编辑表格内容的所有数据 

                                        foreach (var obj in ((dynamic)value))
                                        {
                                            if (obj.Id == opertionData.RowId)
                                            {
                                                dica = obj;
                                            }
                                        }

                                        //先根据rowid并且 编辑表格内容的所有数据 
                                        var tableEditRowData = item._editFileList.Where(t => t.RowId == opertionData.RowId && opertionData.Type == 0).ToList();
                                        //循环赋值给对象
                                        var filterData = tableEditRowData.Select(t => new { t.FieldName, t.OldValue, t.NewValue, t.TableFieldName, t.RowId }).ToList();
                                        //if (filterProcessAddTable != null)
                                        //{
                                        //找到工步
                                        var filterStepDataContent = filterProcessAddTableRowContent.EditFileStepInfos?.FirstOrDefault(t => t.StepId == opertionData.StepId);

                                        if (filterStepDataContent != null)
                                        {

                                            //找到表
                                            var tableData = filterStepDataContent.EditFileTableInfos?.FirstOrDefault(t => t.EditFileStepInfoId == opertionData.StepId && t.TableFieldName == opertionData.TableFieldName);
                                            if (tableData != null)
                                            {

                                                var tableDataRow = tableData.EditFileRowInfos?.FirstOrDefault(t => t.RowId == opertionData.RowId.Value);
                                                if (tableDataRow != null)
                                                {
                                                    //dynamic list = ((dynamic)value).Id;
                                                    //20221208修改
                                                    var tableDataRowSource = tableDataRow.EditFileTableDataInfos?.FirstOrDefault(t => t.EditFileRowInfoId == opertionData.RowId.Value && (t.FieldName).ToLower() == (opertionData.FieldName).ToLower());
                                                    if (tableDataRowSource != null)
                                                    {

                                                        continue;
                                                        //difValue = opertionData.NewValue.Exceptblanks().SplitHtml2().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks().SplitHtml2());
                                                        //if (difValue != "")
                                                        //{
                                                        //    //str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
                                                        //    //str = opertionData.OldValue + "<ins style='background:#e6ffe6;'><strong>" + difValue + "</strong></ins>";
                                                        //    str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
                                                        //}
                                                        //else
                                                        //{
                                                        //    str = opertionData.OldValue;
                                                        //}

                                                        //editFileTableDataInfo = new EditFileTableDataInfo
                                                        //{

                                                        //    EditFileRowInfoId = tableDataRow.Id,
                                                        //    //      UniqueId = tableDataRow.UniqueId,
                                                        //    FieldName = opertionData.FieldName,
                                                        //    DisplayName = opertionData.FieldDisplayName,
                                                        //    Value = opertionData.OldValue,
                                                        //    NewValue = opertionData.NewValue,
                                                        //    Show = true
                                                        //};

                                                        //tableDataRowSource = editFileTableDataInfo;
                                                    }
                                                    else
                                                    {

                                                        Dictionary<string, string> diction = new Dictionary<string, string>();
                                                        if (dica != null)
                                                        {
                                                            //获取所有字段

                                                            //找到该行的全部数据添加到字典
                                                            var prop = dica.GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
                                                            foreach (var ac in prop)
                                                            {
                                                                //var val =((dynamic)ac).GetValue(dica);
                                                                diction.Add(((dynamic)ac).Name, Convert.ToString(((dynamic)ac).GetValue(dica)));
                                                            }
                                                        }
                                                        table.TableKey = fieldname;
                                                        table.TableName = tableFieldName;
                                                        table.FiledDesc = filedMap[table.TableName].filedValue;
                                                        table.FiledName = filedMap[table.TableName].filedKey;
                                                        //循环赋值
                                                        var editFileTableDataInfoByRowId = tableDataRow.EditFileTableDataInfos?.Count(t => t.EditFileRowInfoId == opertionData.RowId);
                                                        if (editFileTableDataInfoByRowId == null || editFileTableDataInfoByRowId == 0)
                                                        {
                                                            for (int i = 0; i < table.FiledDesc.Count; i++)
                                                            {
                                                                string oldValue = "";
                                                                string dicKey = "";
                                                                string dicValue = "";
                                                                if (diction.Count > 0)
                                                                {
                                                                    foreach (var dicStr in diction)
                                                                    {
                                                                        dicKey = dicStr.Key;
                                                                        dicValue = dicStr.Value;
                                                                        bool kg = false;
                                                                        var tableFiled = table.FiledDesc[i].ToLower();
                                                                        if (dicKey.ToLower() == tableFiled)
                                                                        {
                                                                            foreach (var valueData in filterData)
                                                                            {
                                                                                if (valueData.FieldName.ToLower() == dicKey.ToLower())
                                                                                {
                                                                                    dicValue = valueData.NewValue;
                                                                                    oldValue = valueData.OldValue;
                                                                                    kg = true;
                                                                                }
                                                                            }
                                                                            EditFileTableDataInfo editFileTableDataInfo = new EditFileTableDataInfo
                                                                            {
                                                                                EditFileRowInfoId = editFileRowInfo.Id,
                                                                                //  UniqueId = tableDataRow.UniqueId,
                                                                                FieldName = table.FiledDesc[i],
                                                                                DisplayName = table.FiledName[i],
                                                                                Show = true,
                                                                                Value = kg == false ? dicValue : oldValue,
                                                                                NewValue = kg == false ? "" : dicValue
                                                                            };
                                                                            if (tableDataRow.EditFileTableDataInfos == null)
                                                                            {
                                                                                tableDataRow.EditFileTableDataInfos = new List<EditFileTableDataInfo>();
                                                                                tableDataRow.EditFileTableDataInfos.Add(editFileTableDataInfo);
                                                                            }
                                                                            else
                                                                            {
                                                                                tableDataRow.EditFileTableDataInfos.Add(editFileTableDataInfo);
                                                                            }
                                                                            //tableDataRow.EditFileTableDataInfos.Add(editFileTableDataInfo);

                                                                        }
                                                                    }
                                                                }

                                                            }
                                                        }
                                                        //if (tableDataRow.EditFileTableDataInfos != null && tableDataRow.EditFileTableDataInfos.Count > 0)
                                                        //{
                                                        //    var addMs = tableDataRow.EditFileTableDataInfos.FirstOrDefault(t => t.FieldName.ToLower() == opertionData.FieldName.ToLower());
                                                        //    if (addMs != null)
                                                        //    {
                                                        //        addMs.Value = opertionData.NewValue;
                                                        //        //if (addMs.Value != opertionData.OldValue)
                                                        //        //{
                                                        //        //    difValue = addMs.Value.Exceptblanks().SplitHtml2().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks().SplitHtml2());
                                                        //        //    if (difValue != "")
                                                        //        //    {
                                                        //        //        //str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
                                                        //        //        //str = opertionData.OldValue + "<ins style='background:#e6ffe6;'><strong>" + difValue + "</strong></ins>";
                                                        //        //        str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
                                                        //        //    }
                                                        //        //    else
                                                        //        //    {
                                                        //        //        str = opertionData.OldValue;
                                                        //        //    }


                                                        //        // }
                                                        //    }
                                                        //}

                                                    }
                                                }
                                                else
                                                {

                                                    editFileRowInfo = new EditFileRowInfo
                                                    {
                                                        //Id = opertionData.RowId.Value,
                                                        Id = Guid.NewGuid(),
                                                        RowId = opertionData.RowId.Value,
                                                        //   UniqueId = opertionData.UniqueId,
                                                        // EditFileTableInfoId = opertionData.TableId.Value,
                                                        NewRow = false,
                                                        DeletedRow = false
                                                    };
                                                    Dictionary<string, string> diction = new Dictionary<string, string>();
                                                    if (dica != null)
                                                    {
                                                        //获取所有字段

                                                        //找到该行的全部数据添加到字典
                                                        var prop = dica.GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
                                                        foreach (var ac in prop)
                                                        {
                                                            //var val =((dynamic)ac).GetValue(dica);
                                                            diction.Add(((dynamic)ac).Name, Convert.ToString(((dynamic)ac).GetValue(dica)));
                                                        }
                                                    }
                                                    table.TableKey = fieldname;
                                                    table.TableName = tableFieldName;
                                                    table.FiledDesc = filedMap[table.TableName].filedValue;
                                                    table.FiledName = filedMap[table.TableName].filedKey;

                                                    //循环赋值
                                                    var editFileTableDataInfoByRowId = editFileRowInfo.EditFileTableDataInfos?.Count(t => t.EditFileRowInfoId == opertionData.RowId);
                                                    if (editFileTableDataInfoByRowId == null || editFileTableDataInfoByRowId == 0)
                                                    {


                                                        for (int i = 0; i < table.FiledDesc.Count; i++)
                                                        {
                                                            string oldValue = "";
                                                            string dicKey = "";
                                                            string dicValue = "";
                                                          
                                                            foreach (var dicStr in diction)
                                                            {
                                                                bool kg = false;
                                                                dicKey = dicStr.Key;
                                                                dicValue = dicStr.Value;

                                                                var tableFiled = table.FiledDesc[i].ToLower();
                                                                if (dicKey.ToLower() == tableFiled)
                                                                {
                                                                    foreach (var valueData in filterData)
                                                                    {
                                                                        if (valueData.FieldName.ToLower() == dicKey.ToLower())
                                                                        {
                                                                            dicValue = valueData.NewValue;
                                                                            oldValue = valueData.OldValue;
                                                                            kg = true;
                                                                        }
                                                                    }
                                                                    //如果为false 值为旧
                                                                  
                                                                    EditFileTableDataInfo editFileTableDataInfo = new EditFileTableDataInfo
                                                                    {
                                                                        EditFileRowInfoId = editFileRowInfo.Id,
                                                                        //  UniqueId = tableDataRow.UniqueId,
                                                                        FieldName = table.FiledDesc[i],
                                                                        DisplayName = table.FiledName[i],
                                                                        Show = true,
                                                                        Value = kg==false? dicValue: oldValue,
                                                                        NewValue = kg == false?"":dicValue
                                                                    };
                                                                    if (editFileRowInfo.EditFileTableDataInfos == null)
                                                                    {
                                                                        editFileRowInfo.EditFileTableDataInfos = new List<EditFileTableDataInfo>();
                                                                        editFileRowInfo.EditFileTableDataInfos.Add(editFileTableDataInfo);
                                                                    }
                                                                    else
                                                                    {
                                                                        editFileRowInfo.EditFileTableDataInfos.Add(editFileTableDataInfo);
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }

                                                    //var addMs = editFileRowInfo.EditFileTableDataInfos.FirstOrDefault(t => t.FieldName.ToLower() == opertionData.FieldName.ToLower());
                                                    //if (addMs != null)
                                                    //{
                                                    //    addMs.Value = opertionData.NewValue;
                                                    //    //if (addMs.Value != opertionData.OldValue)
                                                    //    //    {
                                                    //    //        difValue = addMs.Value.Exceptblanks().SplitHtml2().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks().SplitHtml2());
                                                    //    //        // difValue = addMs.Value.Exceptblanks().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks());
                                                    //    //        if (difValue != "")
                                                    //    //        {
                                                    //    //            //str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
                                                    //    //            //str = opertionData.OldValue + "<ins style='background:#e6ffe6;'><strong>" + difValue + "</strong></ins>";
                                                    //    //            str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
                                                    //    //        }
                                                    //    //        else
                                                    //    //        {
                                                    //    //            str = opertionData.OldValue;
                                                    //    //        }


                                                    //    //    }
                                                    //}
                                                    if (tableData.EditFileRowInfos == null)
                                                    {
                                                        tableData.EditFileRowInfos = new List<EditFileRowInfo>();
                                                        tableData.EditFileRowInfos.Add(editFileRowInfo);
                                                    }
                                                    else
                                                    {
                                                        tableData.EditFileRowInfos.Add(editFileRowInfo);
                                                    }
                                                    //tableData.EditFileRowInfos.Add(editFileRowInfo);
                                                }
                                            }
                                            else
                                            {
                                                var tableNewBool = item._editFileList.FirstOrDefault(t => t.TableFieldName == opertionData.TableFieldName && t.StepId == opertionData.StepId);

                                                //新增表行
                                                //否则新增
                                                editFileTableInfo = new EditFileTableInfo
                                                {
                                                    Id = Guid.NewGuid(),
                                                    EditFileStepInfoId = opertionData.StepId.Value,
                                                    FileProcessesId = opertionData.ProcessId.Value.ToString(),
                                                    TableFieldName = opertionData.TableFieldName,
                                                    TableName = tableFieldName,
                                                    //   UniqueId = opertionData.UniqueId,
                                                    NewTable = tableNewBool?.Type != 2 ? false : true
                                                };

                                                //新增表行
                                                editFileRowInfo = new EditFileRowInfo
                                                {
                                                    Id =Guid.NewGuid(),
                                                    RowId =opertionData.RowId.Value,
                                                    //   UniqueId = opertionData.UniqueId,
                                                    // EditFileTableInfoId = opertionData.TableId.Value,
                                                    NewRow = false,
                                                    DeletedRow = false
                                                };
                                                Dictionary<string, string> diction = new Dictionary<string, string>();
                                                if (dica != null)
                                                {
                                                    //获取所有字段

                                                    //找到该行的全部数据添加到字典
                                                    var prop = dica.GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
                                                    foreach (var ac in prop)
                                                    {
                                                        //var val =((dynamic)ac).GetValue(dica);
                                                        diction.Add(((dynamic)ac).Name, Convert.ToString(((dynamic)ac).GetValue(dica)));
                                                    }
                                                }
                                                table.TableKey = fieldname;
                                                table.TableName = tableFieldName;
                                                table.FiledDesc = filedMap[table.TableName].filedValue;
                                                table.FiledName = filedMap[table.TableName].filedKey;
                                                //循环赋值
                                                var editFileTableDataInfoByRowId = editFileRowInfo.EditFileTableDataInfos?.Count(t => t.EditFileRowInfoId == opertionData.RowId);
                                                if (editFileTableDataInfoByRowId == null || editFileTableDataInfoByRowId == 0)
                                                {

                                                    for (int i = 0; i < table.FiledDesc.Count; i++)
                                                    {
                                                        string oldValue = "";
                                                        string dicKey = "";
                                                        string dicValue = "";
                                                     
                                                        foreach (var dicStr in diction)
                                                        {
                                                            bool kg = false;
                                                            dicKey = dicStr.Key;
                                                            dicValue = dicStr.Value;

                                                            var tableFiled = table.FiledDesc[i].ToLower();
                                                            if (dicKey.ToLower() == tableFiled)
                                                            {

                                                                foreach (var valueData in filterData)
                                                                {
                                                                    if (valueData.FieldName.ToLower() == dicKey.ToLower())
                                                                    {
                                                                        dicValue = valueData.NewValue;
                                                                        oldValue = valueData.OldValue;
                                                                        kg = true;
                                                                    }
                                                                }
                                                                EditFileTableDataInfo editFileTableDataInfo = new EditFileTableDataInfo
                                                                {
                                                                    EditFileRowInfoId = editFileRowInfo.RowId.Value,
                                                                    //  UniqueId = tableDataRow.UniqueId,
                                                                    FieldName = table.FiledDesc[i],
                                                                    DisplayName = table.FiledName[i],
                                                                    Show = true,
                                                                    Value = kg == false ? dicValue : oldValue,
                                                                    NewValue = kg == false ? "" : dicValue
                                                                };

                                                                if (editFileRowInfo.EditFileTableDataInfos == null)
                                                                {
                                                                    editFileRowInfo.EditFileTableDataInfos = new List<EditFileTableDataInfo>();
                                                                    editFileRowInfo.EditFileTableDataInfos.Add(editFileTableDataInfo);
                                                                }
                                                                else
                                                                {
                                                                    editFileRowInfo.EditFileTableDataInfos.Add(editFileTableDataInfo);
                                                                }
                                                            }
                                                        }



                                                    }
                                                }


                                                //var addMs = editFileRowInfo.EditFileTableDataInfos.FirstOrDefault(t => t.FieldName.ToLower() == opertionData.FieldName.ToLower());
                                                //if (addMs != null)
                                                //{
                                                //    addMs.Value = opertionData.NewValue;
                                                //    //if (addMs.Value != opertionData.OldValue)
                                                //    //{
                                                //    //    difValue = addMs.Value.Exceptblanks().SplitHtml2().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks().SplitHtml2());
                                                //    //    // difValue = addMs.Value.Exceptblanks().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks());
                                                //    //    if (difValue != "")
                                                //    //    {
                                                //    //        //str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
                                                //    //        //str = opertionData.OldValue + "<ins style='background:#e6ffe6;'><strong>" + difValue + "</strong></ins>";
                                                //    //        str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
                                                //    //    }
                                                //    //    else
                                                //    //    {
                                                //    //        str = opertionData.OldValue;
                                                //    //    }

                                                //    //    addMs.Value = str;
                                                //    //}
                                                //}
                                                for (int i = 0; i < table.FiledDesc.Count; i++)
                                                {
                                                    editFileTableStrunctInfo = new EditFileTableStructInfo
                                                    {
                                                        EditFileTableInfoId = editFileTableInfo.Id,
                                                        FieldName = table.FiledDesc[i],
                                                        DisplayName = table.FiledName[i],
                                                        Index = i,
                                                        Show = true
                                                    };
                                                    editFileTableStrunctInfoList.Add(editFileTableStrunctInfo);
                                                }
                                                if (editFileTableInfo.EditFileRowInfos == null)
                                                {
                                                    editFileTableInfo.EditFileRowInfos = new List<EditFileRowInfo>();
                                                    editFileTableInfo.EditFileRowInfos.Add(editFileRowInfo);
                                                }
                                                else
                                                {
                                                    editFileTableInfo.EditFileRowInfos.Add(editFileRowInfo);
                                                }
                                                editFileTableInfo.EditFileTableStructInfos = editFileTableStrunctInfoList;
                                                if (filterStepDataContent.EditFileTableInfos == null)
                                                {
                                                    filterStepDataContent.EditFileTableInfos = new List<EditFileTableInfo>();
                                                    filterStepDataContent.EditFileTableInfos.Add(editFileTableInfo);
                                                }
                                                else
                                                {
                                                    filterStepDataContent.EditFileTableInfos.Add(editFileTableInfo);
                                                }

                                            }
                                        }
                                        else
                                        {

                                            var tableNewBool = item._editFileList.FirstOrDefault(t => t.TableFieldName == opertionData.TableFieldName && t.StepId == opertionData.StepId);
                                            //否则新增
                                            editFileTableInfo = new EditFileTableInfo
                                            {
                                                Id = Guid.NewGuid(),
                                                EditFileStepInfoId = opertionData.StepId.Value,
                                                FileProcessesId = opertionData.ProcessId.Value.ToString(),
                                                TableFieldName = opertionData.TableFieldName,
                                                TableName = tableFieldName,
                                                //    UniqueId = opertionData.UniqueId,
                                                NewTable = tableNewBool?.Type != 2 ? false : true
                                            };

                                            //新增表行
                                            editFileRowInfo = new EditFileRowInfo
                                            {
                                                //  Id = opertionData.RowId.Value,

                                                Id = Guid.NewGuid(),
                                                RowId = opertionData.RowId.Value,
                                                //   UniqueId = opertionData.UniqueId,
                                                // EditFileTableInfoId = opertionData.TableId.Value,
                                                NewRow = false,
                                                DeletedRow = false
                                            };
                                            //editFileTableDataInfo = new EditFileTableDataInfo
                                            //{
                                            //    EditFileRowInfoId = opertionData.RowId.Value,
                                            //    //  UniqueId = tableDataRow.UniqueId,
                                            //    FieldName = opertionData.FieldName,
                                            //    DisplayName = opertionData.FieldDisplayName,
                                            //    Value = opertionData.OldValue,
                                            //    NewValue = opertionData.NewValue,
                                            //    Show = true
                                            //};


                                            Dictionary<string, string> diction = new Dictionary<string, string>();
                                            if (dica != null)
                                            {
                                                //获取所有字段

                                                //找到该行的全部数据添加到字典
                                                var prop = dica.GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
                                                foreach (var ac in prop)
                                                {
                                                    //var val =((dynamic)ac).GetValue(dica);
                                                    diction.Add(((dynamic)ac).Name, Convert.ToString(((dynamic)ac).GetValue(dica)));
                                                }
                                            }
                                            table.TableKey = fieldname;
                                            table.TableName = tableFieldName;
                                            table.FiledDesc = filedMap[table.TableName].filedValue;
                                            table.FiledName = filedMap[table.TableName].filedKey;
                                            var editFileTableDataInfoByRowId = editFileRowInfo.EditFileTableDataInfos?.Count(t => t.EditFileRowInfoId == opertionData.RowId);
                                            if (editFileTableDataInfoByRowId == null || editFileTableDataInfoByRowId == 0)
                                            {
                                                //循环赋值
                                                for (int i = 0; i < table.FiledDesc.Count; i++)
                                                {
                                                    string oldValue = "";
                                                    string dicKey = "";
                                                    string dicValue = "";
                                                    foreach (var dicStr in diction)
                                                    {
                                                        dicKey = dicStr.Key;
                                                        dicValue = dicStr.Value;
                                                        bool kg = false;
                                                        var tableFiled = table.FiledDesc[i].ToLower();
                                                        if (dicKey.ToLower() == tableFiled)
                                                        {
                                                            foreach (var valueData in filterData)
                                                            {
                                                                if (valueData.FieldName.ToLower() == dicKey.ToLower())
                                                                {
                                                                    dicValue = valueData.NewValue;
                                                                    oldValue = valueData.OldValue;
                                                                    kg = true;
                                                                }
                                                            }
                                                            EditFileTableDataInfo editFileTableDataInfo = new EditFileTableDataInfo
                                                            {
                                                                EditFileRowInfoId = editFileRowInfo.RowId.Value,
                                                                //  UniqueId = tableDataRow.UniqueId,
                                                                FieldName = table.FiledDesc[i],
                                                                DisplayName = table.FiledName[i],
                                                                Show = true,
                                                                Value = kg == false ? dicValue : oldValue,
                                                                NewValue = kg == false ? "" : dicValue
                                                            };
                                                            if (editFileRowInfo.EditFileTableDataInfos == null)
                                                            {
                                                                editFileRowInfo.EditFileTableDataInfos = new List<EditFileTableDataInfo>();
                                                                editFileRowInfo.EditFileTableDataInfos.Add(editFileTableDataInfo);
                                                            }
                                                            else
                                                            {
                                                                editFileRowInfo.EditFileTableDataInfos.Add(editFileTableDataInfo);
                                                            }
                                                        }
                                                    }
                                                }
                                            }



                                            //var addMs = editFileRowInfo.EditFileTableDataInfos.FirstOrDefault(t => t.FieldName.ToLower() == opertionData.FieldName.ToLower());
                                            //if (addMs != null)
                                            //{
                                            //    addMs.Value = opertionData.NewValue;
                                            //    //if (addMs.Value != opertionData.OldValue)
                                            //    //{
                                            //    //    difValue = addMs.Value.Exceptblanks().SplitHtml2().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks().SplitHtml2());
                                            //    //    //   difValue = addMs.Value.Exceptblanks().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks());

                                            //    //    if (difValue != "")
                                            //    //    {
                                            //    //        //str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
                                            //    //        //str = opertionData.OldValue + "<ins style='background:#e6ffe6;'><strong>" + difValue + "</strong></ins>";
                                            //    //        str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
                                            //    //    }
                                            //    //    else
                                            //    //    {
                                            //    //        str = opertionData.OldValue;
                                            //    //    }

                                            //    //    addMs.Value = str;
                                            //    //}
                                            //}
                                            for (int i = 0; i < table.FiledDesc.Count; i++)
                                            {
                                                editFileTableStrunctInfo = new EditFileTableStructInfo
                                                {
                                                    EditFileTableInfoId = editFileTableInfo.Id,
                                                    FieldName = table.FiledDesc[i],
                                                    DisplayName = table.FiledName[i],
                                                    Index = i,
                                                    Show = true
                                                };
                                                editFileTableStrunctInfoList.Add(editFileTableStrunctInfo);

                                            }
                                            editFileTableInfo.EditFileTableStructInfos = editFileTableStrunctInfoList;
                                            //editFileTableInfo.EditFileRowInfos.Add(editFileRowInfo);
                                            if (editFileTableInfo.EditFileRowInfos == null)
                                            {
                                                editFileTableInfo.EditFileRowInfos = new List<EditFileRowInfo>();
                                                editFileTableInfo.EditFileRowInfos.Add(editFileRowInfo);
                                            }
                                            //difValue = opertionData.NewValue.Exceptblanks().SplitHtml2().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks().SplitHtml2());
                                            //// difValue = opertionData.NewValue.Exceptblanks().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks());
                                            //if (difValue != "")
                                            //{
                                            //    //str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
                                            //    //str = opertionData.OldValue + "<ins style='background:#e6ffe6;'><strong>" + difValue + "</strong></ins>";
                                            //    str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
                                            //}
                                            //else
                                            //{
                                            //    str = opertionData.OldValue;
                                            //}


                                            var stepNewBool = item._editFileList.Count(t => t.StepId == opertionData.StepId && t.Type == 4);
                                            //NewStep = stepNewBool == 0 ? false : true,
                                            //NewStep = stepNewBool.Type !=null? false : true,
                                            //否则新增
                                            editFileStepInfo = new EditFileStepInfo
                                            {
                                                //Id = opertionData.StepId.Value,
                                                Id = Guid.NewGuid(),
                                                StepId = opertionData.StepId.Value,
                                                EditFileProcessInfoId = editFileProcessInfoId,
                                                NewStep = stepNewBool == 0 ? false : true,
                                                //    UniqueId = opertionData.UniqueId,
                                                //TWorkStepContent = str,
                                                WorkStepName = WorkName,
                                                WorkStepNumber = currentWork?.WorkStepNumber.ToString(),
                                                UpdateStepContent = true,
                                                WorkStepContent = opertionData.OldValue,
                                                WorkStepUpdateContent = opertionData.NewValue,
                                                WorkStepWorking = currentWork == null ? 0 : (int)currentWork.WorkStepWorking
                                            };
                                            if (editFileStepInfo.EditFileTableInfos == null)
                                            {
                                                editFileStepInfo.EditFileTableInfos = new List<EditFileTableInfo>();
                                                editFileStepInfo.EditFileTableInfos.Add(editFileTableInfo);
                                            }
                                            else
                                            {
                                                editFileStepInfo.EditFileTableInfos.Add(editFileTableInfo);
                                            }
                                            //editFileStepInfo.EditFileTableInfos.Add(editFileTableInfo);
                                            if (filterProcessAddTableRowContent.EditFileStepInfos == null)
                                            {
                                                filterProcessAddTableRowContent.EditFileStepInfos = new List<EditFileStepInfo>();
                                                filterProcessAddTableRowContent.EditFileStepInfos.Add(editFileStepInfo);
                                            }
                                            else
                                            {
                                                filterProcessAddTableRowContent.EditFileStepInfos.Add(editFileStepInfo);
                                            }

                                            
                                            //editFileStepInfoList.Add(editFileStepInfo);
                                        }

                                        //int cerid = pphr.FindIndex(t=>t.RowId.Value ==opertionData.RowId.Value);
                                        //pphr.RemoveAt(cerid);
                                        //List<BackOperationDto> list = pphr.Where(t => t.RowId.ToString().Equals(opertionData.RowId.Value.ToString())&&t.Type ==0).ToList();
                                        //for (int i =0;i<list.Count;i++)
                                        //{
                                        //    int cerid = pphr.FindIndex(t=>t.RowId.ToString().Equals(list[i].RowId.Value.ToString()));
                                        //    pphr.RemoveAt(cerid);
                                        //}

                                  
                                        //List<Guid?>  idlist= pphr.Where(t => t.RowId != null).Select(t=>t.RowId).ToList();
                                        //pphr = pphr.Where(t =>! idlist.Contains(opertionData.RowId)).ToList();
                                        break;
                                    case 1:
                                        operationLog.OperationType = OperationTypes.表格添加行;
                                        editFileRowInfolist = new List<EditFileRowInfo>();
                                        editFileTableStrunctInfoList = new List<EditFileTableStructInfo>();
                                        //找到工序
                                        //修改
                                        var filterProcessAddTableRow = editFileProcessInfoList.FirstOrDefault(t => t.EditFileProcessId == item._editFileList[j].ProcessId);
                                        //if (filterProcessAddTable != null)
                                        //{
                                        //找到工步
                                        var filterStepData = filterProcessAddTableRow.EditFileStepInfos?.FirstOrDefault(t => t.StepId == item._editFileList[j].StepId);
                                        if (filterStepData != null)
                                        {
                                            //找到表
                                            var tableData = filterStepData.EditFileTableInfos?.FirstOrDefault(t => t.EditFileStepInfoId == item._editFileList[j].StepId && t.TableFieldName == item._editFileList[j].TableFieldName);
                                            if (tableData != null)
                                            {
                                                //找到行
                                                var tableDataRow = tableData.EditFileRowInfos?.FirstOrDefault(t => t.RowId == item._editFileList[j].RowId.Value);
                                                if (tableDataRow != null)
                                                {
                                                    //存在则更新
                                                    editFileRowInfo = new EditFileRowInfo
                                                    {
                                                        // Id = opertionData.RowId.Value,
                                                        Id =Guid.NewGuid(),
                                                        RowId = opertionData.RowId.Value,
                                                        // UniqueId = opertionData.UniqueId,
                                                        //      EditFileTableInfoId = opertionData.TableId.Value,
                                                        NewRow = true
                                                    };
                                                    tableDataRow = editFileRowInfo;
                                                }
                                                else
                                                {
                                                    //否则新增
                                                    editFileRowInfo = new EditFileRowInfo
                                                    {
                                                        //Id = opertionData.RowId.Value,
                                                        Id = Guid.NewGuid(),
                                                        RowId = opertionData.RowId.Value,
                                                        // UniqueId = opertionData.UniqueId,
                                                        //      EditFileTableInfoId = opertionData.TableId.Value,
                                                        NewRow = true,
                                                    };
                                                    if (tableData.EditFileRowInfos == null)
                                                    {
                                                        tableData.EditFileRowInfos = new List<EditFileRowInfo>();
                                                        tableData.EditFileRowInfos.Add(editFileRowInfo);
                                                    }
                                                    else
                                                    {
                                                        tableData.EditFileRowInfos.Add(editFileRowInfo);
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                var tableNewBool = item._editFileList.FirstOrDefault(t => t.TableFieldName == opertionData.TableFieldName && t.StepId == opertionData.StepId);
                                                //NewTable = tableNewBool?.Type != 2 ? false : true
                                                //否则新增
                                                editFileTableInfo = new EditFileTableInfo
                                                {
                                                    Id = Guid.NewGuid(),
                                                    EditFileStepInfoId = opertionData.StepId.Value,
                                                    FileProcessesId = opertionData.ProcessId.Value.ToString(),
                                                    TableFieldName = opertionData.TableFieldName,
                                                    TableName = tableFieldName,
                                                    //  UniqueId = opertionData.UniqueId,
                                                    NewTable = tableNewBool?.Type != 2 ? false : true
                                                };
                                                table.TableKey = fieldname;
                                                table.TableName = tableFieldName;
                                                table.FiledDesc = filedMap[table.TableName].filedValue;
                                                table.FiledName = filedMap[table.TableName].filedKey;
                                                for (int i = 0; i < table.FiledDesc.Count; i++)
                                                {
                                                    editFileTableStrunctInfo = new EditFileTableStructInfo
                                                    {
                                                        EditFileTableInfoId = editFileTableInfo.Id,
                                                        FieldName = table.FiledDesc[i],
                                                        DisplayName = table.FiledName[i],
                                                        Index = i,
                                                        Show = true
                                                    };
                                                    editFileTableStrunctInfoList.Add(editFileTableStrunctInfo);
                                                }

                                                //foreach (string str in table.FiledDesc)
                                                //{

                                                //    foreach (string str2 in table.FiledName)
                                                //    {
                                                //        editFileTableStrunctInfo = new EditFileTableStructInfo
                                                //        {
                                                //            FieldName = str,
                                                //            DisplayName = str2
                                                //        };
                                                //        editFileTableStrunctInfoList.Add(editFileTableStrunctInfo);
                                                //        break;
                                                //    }
                                                //}


                                                //新增表行
                                                editFileRowInfo = new EditFileRowInfo
                                                {
                                                    //  Id = opertionData.RowId.Value,
                                                    Id = Guid.NewGuid(),
                                                    RowId = opertionData.RowId.Value,
                                                    //   UniqueId = opertionData.UniqueId,
                                                    //   EditFileTableInfoId = opertionData.TableId.Value,
                                                    NewRow = true,
                                                };
                                                if (editFileTableInfo.EditFileRowInfos == null)
                                                {
                                                    editFileTableInfo.EditFileRowInfos = new List<EditFileRowInfo>();
                                                    editFileTableInfo.EditFileRowInfos.Add(editFileRowInfo);
                                                }
                                                else
                                                {
                                                    editFileTableInfo.EditFileRowInfos.Add(editFileRowInfo);
                                                }
                                                editFileTableInfo.EditFileTableStructInfos = editFileTableStrunctInfoList;

                                                if (filterStepData.EditFileTableInfos == null)
                                                {
                                                    filterStepData.EditFileTableInfos = new List<EditFileTableInfo>();
                                                    filterStepData.EditFileTableInfos.Add(editFileTableInfo);
                                                }
                                                else
                                                {
                                                    filterStepData.EditFileTableInfos.Add(editFileTableInfo);
                                                }
                                            }
                                        }
                                        else
                                        {
                                            var stepNewBool = item._editFileList.Count(t => t.StepId == opertionData.StepId && t.Type == 4);
                                            // difValue = opertionData.NewValue.Exceptblanks().SplitHtml2().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks().SplitHtml2());
                                            //if (difValue != "")
                                            //{
                                            //    //str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
                                            //    //str = opertionData.OldValue + "<ins style='background:#e6ffe6;'><strong>" + difValue + "</strong></ins>";
                                            //    str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
                                            //}
                                            //else
                                            //{
                                            //    str = opertionData.OldValue;
                                            //}
                                            //否则新增
                                            editFileStepInfo = new EditFileStepInfo
                                            {
                                              //  Id = opertionData.StepId.Value,
                                              Id =Guid.NewGuid(),
                                              StepId = opertionData.StepId.Value,
                                                EditFileProcessInfoId = opertionData.ProcessId.Value,
                                                NewStep = stepNewBool == 0 ? false : true,
                                                //      UniqueId = opertionData.UniqueId,
                                                TWorkStepContent = opertionData.OldValue,
                                                WorkStepName = WorkName,
                                                WorkStepNumber = currentWork?.WorkStepNumber.ToString(),
                                                UpdateStepContent = true,
                                                WorkStepContent = opertionData.OldValue,
                                                WorkStepUpdateContent = opertionData.NewValue,
                                                WorkStepWorking = currentWork == null ? 0 : (int)currentWork.WorkStepWorking
                                            };
                                            var tableNewBool = item._editFileList.FirstOrDefault(t => t.TableFieldName == opertionData.TableFieldName && t.StepId == opertionData.StepId);
                                            //NewTable = tableNewBool?.Type != 2 ? false : true
                                            //否则新增
                                            editFileTableInfo = new EditFileTableInfo
                                            {
                                                Id = Guid.NewGuid(),
                                                EditFileStepInfoId = opertionData.StepId.Value,
                                                FileProcessesId = opertionData.ProcessId.Value.ToString(),
                                                TableFieldName = opertionData.TableFieldName,
                                                TableName = tableFieldName,
                                                //  UniqueId = opertionData.UniqueId,
                                                NewTable = tableNewBool?.Type != 2 ? false : true
                                            };
                                            table.TableKey = fieldname;
                                            table.TableName = tableFieldName;
                                            table.FiledDesc = filedMap[table.TableName].filedValue;
                                            table.FiledName = filedMap[table.TableName].filedKey;
                                            for (int i = 0; i < table.FiledDesc.Count; i++)
                                            {
                                                editFileTableStrunctInfo = new EditFileTableStructInfo
                                                {
                                                    EditFileTableInfoId = editFileTableInfo.Id,
                                                    FieldName = table.FiledDesc[i],
                                                    DisplayName = table.FiledName[i],
                                                    Index = i,
                                                    Show = true
                                                };
                                                editFileTableStrunctInfoList.Add(editFileTableStrunctInfo);
                                            }

                                            editFileTableInfo.EditFileTableStructInfos = editFileTableStrunctInfoList;

                                            //新增表行
                                            editFileRowInfo = new EditFileRowInfo
                                            {
                                                //Id = opertionData.RowId.Value,
                                                Id = Guid.NewGuid(),
                                                RowId = opertionData.RowId.Value,
                                                //   UniqueId = opertionData.UniqueId,
                                                //   EditFileTableInfoId = opertionData.TableId.Value,
                                                NewRow = true,
                                            };
                                            if (editFileTableInfo.EditFileRowInfos == null)
                                            {
                                                editFileTableInfo.EditFileRowInfos = new List<EditFileRowInfo>();
                                                editFileTableInfo.EditFileRowInfos.Add(editFileRowInfo);
                                            }
                                            else
                                            {
                                                editFileTableInfo.EditFileRowInfos.Add(editFileRowInfo);
                                            }

                                            if (editFileStepInfo.EditFileTableInfos == null)
                                            {
                                                editFileStepInfo.EditFileTableInfos = new List<EditFileTableInfo>();
                                                editFileStepInfo.EditFileTableInfos.Add(editFileTableInfo);
                                            }
                                            else
                                            {
                                                editFileStepInfo.EditFileTableInfos.Add(editFileTableInfo);
                                            }
                                            if (filterProcessAddTableRow.EditFileStepInfos == null)
                                            {
                                                filterProcessAddTableRow.EditFileStepInfos = new List<EditFileStepInfo>();
                                                filterProcessAddTableRow.EditFileStepInfos.Add(editFileStepInfo);
                                            }
                                            else
                                            {
                                                filterProcessAddTableRow.EditFileStepInfos.Add(editFileStepInfo);
                                            }
                                        }
                                        break;
                                    case 2:
                                        operationLog.OperationType = OperationTypes.添加表;
                                        editFileTableStrunctInfoList = new List<EditFileTableStructInfo>();
                                        //editFileTableInfoList.Clear();
                                        //operationLog.Content = ProName + "-" + WorkName + ",添加表:" + tableFieldName;
                                        //editFileTableInfo = new EditFileTableInfo
                                        //{
                                        //    Id = opertionData.Id,
                                        //    EditFileStepInfoId = opertionData.StepId.Value,
                                        //    FileProcessesId = opertionData.ProcessId.Value.ToString(),
                                        //    TableFieldName = tableFieldName,
                                        //    UniqueId = opertionData.UniqueId,
                                        //    NewTable =true
                                        //};
                                        //editFileTableInfoList.Add(editFileTableInfo);

                                        //找到表上的工步

                                        var filterProcessAddTable = editFileProcessInfoList.FirstOrDefault(t => t.EditFileProcessId == item._editFileList[j].ProcessId);
                                        //if (filterProcessAddTable != null)
                                        //{
                                        //找到工步
                                        var filterStepDataTable = filterProcessAddTable.EditFileStepInfos?.FirstOrDefault(t => t.StepId == item._editFileList[j].StepId);

                                        if (filterStepDataTable != null)
                                        {



                                            //找到表
                                            var tableData = filterStepDataTable.EditFileTableInfos?.FirstOrDefault(t => t.EditFileStepInfoId == item._editFileList[j].StepId && t.TableFieldName == item._editFileList[j].TableFieldName);
                                            if (tableData != null)
                                            {

                                                //找到行
                                                //var tableDataRow = tableData.EditFileRowInfos?.FirstOrDefault(t => t.Id == item._editFileList[j].RowId.Value);
                                                //if (tableDataRow != null)
                                                //{
                                                //    //存在则更新
                                                //    editFileRowInfo = new EditFileRowInfo
                                                //    {
                                                //        Id = opertionData.RowId.Value,
                                                //        // UniqueId = opertionData.UniqueId,
                                                //        //      EditFileTableInfoId = opertionData.TableId.Value,
                                                //        NewRow = true
                                                //    };
                                                //    tableDataRow = editFileRowInfo;
                                                //}
                                                //else
                                                //{
                                                //    //否则新增
                                                //    editFileRowInfo = new EditFileRowInfo
                                                //    {
                                                //        Id = opertionData.RowId.Value,
                                                //        // UniqueId = opertionData.UniqueId,
                                                //        //      EditFileTableInfoId = opertionData.TableId.Value,
                                                //        NewRow = true,
                                                //    };
                                                //    if (tableData.EditFileRowInfos == null)
                                                //    {
                                                //        tableData.EditFileRowInfos = new List<EditFileRowInfo>();
                                                //        tableData.EditFileRowInfos.Add(editFileRowInfo);
                                                //    }
                                                //    else
                                                //    {
                                                //        tableData.EditFileRowInfos.Add(editFileRowInfo);
                                                //    }
                                                //}
                                                //大于0 更新
                                                editFileTableInfo = new EditFileTableInfo
                                                {
                                                    Id = Guid.NewGuid(),
                                                    EditFileStepInfoId = opertionData.StepId.Value,
                                                    FileProcessesId = opertionData.ProcessId.Value.ToString(),
                                                    TableFieldName = opertionData.TableFieldName,
                                                    TableName = tableFieldName,
                                                    //               UniqueId = opertionData.UniqueId,
                                                    NewTable = true
                                                };
                                                tableData = editFileTableInfo;
                                            }
                                            else
                                            {


                                                //否则新增
                                                editFileTableInfo = new EditFileTableInfo
                                                {
                                                    Id = Guid.NewGuid(),
                                                    EditFileStepInfoId = opertionData.StepId.Value,
                                                    FileProcessesId = opertionData.ProcessId.Value.ToString(),
                                                    TableFieldName = opertionData.TableFieldName,
                                                    TableName = tableFieldName,
                                                    //  UniqueId = opertionData.UniqueId,
                                                    NewTable = true
                                                };
                                                table.TableKey = fieldname;
                                                table.TableName = tableFieldName;
                                                table.FiledDesc = filedMap[table.TableName].filedValue;
                                                table.FiledName = filedMap[table.TableName].filedKey;
                                                for (int i = 0; i < table.FiledDesc.Count; i++)
                                                {
                                                    editFileTableStrunctInfo = new EditFileTableStructInfo
                                                    {
                                                        EditFileTableInfoId = editFileTableInfo.Id,
                                                        FieldName = table.FiledDesc[i],
                                                        DisplayName = table.FiledName[i],
                                                        Index = i,
                                                        Show = true
                                                    };
                                                    editFileTableStrunctInfoList.Add(editFileTableStrunctInfo);
                                                }
                                                editFileTableInfo.EditFileTableStructInfos = editFileTableStrunctInfoList;
                                                if (filterStepDataTable.EditFileTableInfos == null)
                                                {
                                                    filterStepDataTable.EditFileTableInfos = new List<EditFileTableInfo>();
                                                    filterStepDataTable.EditFileTableInfos.Add(editFileTableInfo);
                                                }
                                                else
                                                {
                                                    filterStepDataTable.EditFileTableInfos.Add(editFileTableInfo);
                                                }
                                            }
                                        }
                                        else
                                        {
                                            //difValue = opertionData.NewValue.Exceptblanks().SplitHtml2().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks().SplitHtml2());
                                            //if (difValue != "")
                                            //{
                                            //    //str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
                                            //    //str = opertionData.OldValue + "<ins style='background:#e6ffe6;'><strong>" + difValue + "</strong></ins>";
                                            //    str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
                                            //}
                                            //else
                                            //{
                                            //    str = opertionData.OldValue;
                                            //}

                                            var stepNewBool = item._editFileList.Count(t => t.StepId == opertionData.StepId && t.Type == 4);
                                            //否则新增
                                            editFileStepInfo = new EditFileStepInfo
                                            {
                                                //  Id = opertionData.StepId.Value,
                                                Id = Guid.NewGuid(),
                                                StepId = opertionData.StepId.Value,
                                                EditFileProcessInfoId = editFileProcessInfoId,
                                                NewStep = stepNewBool == 0 ? false : true,
                                                //                      UniqueId = opertionData.UniqueId,
                                                TWorkStepContent = opertionData.NewValue,
                                                WorkStepName = WorkName,
                                                WorkStepNumber = currentWork?.WorkStepNumber.ToString(),
                                                UpdateStepContent = true,
                                                WorkStepContent = opertionData.OldValue,
                                                WorkStepUpdateContent = opertionData.NewValue,
                                                WorkStepWorking = currentWork == null ? 0 : (int)currentWork.WorkStepWorking
                                            };
                                            //否则新增
                                            editFileTableInfo = new EditFileTableInfo
                                            {
                                                Id = Guid.NewGuid(),
                                                EditFileStepInfoId = opertionData.StepId.Value,
                                                FileProcessesId = opertionData.ProcessId.Value.ToString(),
                                                TableFieldName = opertionData.TableFieldName,
                                                TableName = tableFieldName,
                                                //  UniqueId = opertionData.UniqueId,
                                                NewTable = true
                                            };
                                            table.TableKey = fieldname;
                                            table.TableName = tableFieldName;
                                            table.FiledDesc = filedMap[table.TableName].filedValue;
                                            table.FiledName = filedMap[table.TableName].filedKey;
                                            for (int i = 0; i < table.FiledDesc.Count; i++)
                                            {
                                                editFileTableStrunctInfo = new EditFileTableStructInfo
                                                {
                                                    EditFileTableInfoId = editFileTableInfo.Id,
                                                    FieldName = table.FiledDesc[i],
                                                    DisplayName = table.FiledName[i],
                                                    Index = i,
                                                    Show = true
                                                };
                                                editFileTableStrunctInfoList.Add(editFileTableStrunctInfo);
                                            }
                                            editFileTableInfo.EditFileTableStructInfos = editFileTableStrunctInfoList;



                                            if (editFileStepInfo.EditFileTableInfos == null)
                                            {
                                                editFileStepInfo.EditFileTableInfos = new List<EditFileTableInfo>();
                                                editFileStepInfo.EditFileTableInfos.Add(editFileTableInfo);
                                            }
                                            else
                                            {
                                                editFileStepInfo.EditFileTableInfos.Add(editFileTableInfo);
                                            }
                                            if (filterProcessAddTable.EditFileStepInfos == null)
                                            {
                                                filterProcessAddTable.EditFileStepInfos = new List<EditFileStepInfo>();
                                                filterProcessAddTable.EditFileStepInfos.Add(editFileStepInfo);
                                            }
                                            else
                                            {
                                                filterProcessAddTable.EditFileStepInfos.Add(editFileStepInfo);
                                            }
                                        }

                                        break;
                                    case 3:
                                        operationLog.OperationType = OperationTypes.编辑工步描述;
                                        //if (!string.IsNullOrEmpty(opertionData.ProcessId.ToString()) && !string.IsNullOrEmpty(opertionData.StepId.ToString()))
                                        //{
                                        //    editFileStepInfo = new EditFileStepInfo
                                        //    {
                                        //        Id = opertionData.Id,
                                        //        EditFileProcessInfoId = editFileProcessInfoId,
                                        //        NewStep = false,
                                        //        UniqueId = opertionData.UniqueId,
                                        //        TWorkStepContent = WorkName + currentWork.WorkStepContent,
                                        //        WorkStepName = WorkName,
                                        //        WorkStepNumber = currentWork.WorkStepNumber.ToString(),
                                        //        UpdateStepContent = true,
                                        //        WorkStepContent = currentWork.WorkStepContent,
                                        //        WorkStepUpdateContent = opertionData.NewValue,
                                        //        WorkStepWorking = (int)currentWork.WorkStepWorking
                                        //    };
                                        //    editFileStepInfoList.Add(editFileStepInfo);
                                        //}

                                        //判断工序下有没有相关内容

                                        var filterProcess = editFileProcessInfoList.FirstOrDefault(t => t.EditFileProcessId == item._editFileList[j].ProcessId);
                                        //filterProcess.EditFileStepInfos = new List<EditFileStepInfo>()
                                        //找到工步

                                        var filterStepDataMs = filterProcess.EditFileStepInfos?.FirstOrDefault(t => t.StepId == item._editFileList[j].StepId);
                                        if (filterStepDataMs != null)
                                        {

                                            //difValue = opertionData.NewValue.Exceptblanks().SplitHtml2().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks().SplitHtml2());
                                            //if (difValue != "")
                                            //{
                                            //    //str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
                                            //    //str = opertionData.OldValue + "<ins style='background:#e6ffe6;'><strong>" + difValue + "</strong></ins>";
                                            //    str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
                                            //}
                                            //else
                                            //{
                                            //    str = opertionData.OldValue;
                                            //}

                                            //大于0 更新

                                            filterStepDataMs.Id = opertionData.Id;
                                            filterStepDataMs.StepId = opertionData.StepId.Value;
                                            filterStepDataMs.EditFileProcessInfoId = opertionData.ProcessId.Value;
                                            filterStepDataMs.NewStep = false;
                                            //                      UniqueId = opertionData.UniqueId,
                                            filterStepDataMs.TWorkStepContent = opertionData.OldValue;
                                            filterStepDataMs.WorkStepName = WorkName;
                                            filterStepDataMs.WorkStepNumber = currentWork?.WorkStepNumber.ToString();
                                            filterStepDataMs.UpdateStepContent = true;
                                            filterStepDataMs.WorkStepContent = currentWork?.WorkStepContent;
                                            filterStepDataMs.WorkStepUpdateContent = opertionData.NewValue;
                                            filterStepDataMs.WorkStepWorking = currentWork == null ? 0 : (int)currentWork.WorkStepWorking;
                                        }
                                        else
                                        {

                                            //difValue = opertionData.NewValue.Exceptblanks().SplitHtml2().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks().SplitHtml2());
                                            //if (difValue != "")
                                            //{
                                            //    //str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
                                            //    //str = opertionData.OldValue + "<ins style='background:#e6ffe6;'><strong>" + difValue + "</strong></ins>";
                                            //    str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
                                            //}
                                            //else
                                            //{
                                            //    str = opertionData.OldValue;
                                            //}
                                            //修改
                                            var stepNewBool = item._editFileList.Count(t => t.StepId == opertionData.StepId && t.Type == 4);
                                            //否则新增
                                            editFileStepInfo = new EditFileStepInfo
                                            {
                                                Id =Guid.NewGuid(),
                                                StepId = opertionData.StepId.Value,
                                                EditFileProcessInfoId = opertionData.ProcessId.Value,
                                                NewStep = stepNewBool == 0 ? false : true,

                                                //                          UniqueId = opertionData.UniqueId,
                                                TWorkStepContent = opertionData.OldValue,
                                                WorkStepName = WorkName,
                                                WorkStepNumber = currentWork?.WorkStepNumber.ToString(),
                                                UpdateStepContent = true,
                                                WorkStepContent = opertionData.OldValue,
                                                WorkStepUpdateContent = opertionData.NewValue,
                                                WorkStepWorking = currentWork == null ? 0 : (int)currentWork.WorkStepWorking
                                            };
                                            //if (editFileStepInfo.EditFileTableInfos == null)
                                            //{
                                            //    editFileStepInfo.EditFileTableInfos = new List<EditFileTableInfo>();
                                            //    editFileStepInfo.EditFileTableInfos.Add(editFileTableInfo);
                                            //}
                                            //else
                                            //{
                                            //    editFileStepInfo.EditFileTableInfos.Add(editFileTableInfo);
                                            //}
                                            if (filterProcess.EditFileStepInfos == null)
                                            {
                                                filterProcess.EditFileStepInfos = new List<EditFileStepInfo>();
                                                filterProcess.EditFileStepInfos.Add(editFileStepInfo);
                                            }
                                            else
                                            {
                                                filterProcess.EditFileStepInfos.Add(editFileStepInfo);
                                            }
                                        }
                                        break;
                                    case 4:
                                        operationLog.OperationType = OperationTypes.新增工步;
                                        //判断工序下有没有相关内容
                                        var filterProcessAddStep = editFileProcessInfoList.FirstOrDefault(t => t.EditFileProcessId == item._editFileList[j].ProcessId);
                                        //difValue = opertionData.NewValue.Exceptblanks().SplitHtml2().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks().SplitHtml2());
                                        //if (difValue != "")
                                        //{
                                        //    //str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
                                        //    //str = opertionData.OldValue + "<ins style='background:#e6ffe6;'><strong>" + difValue + "</strong></ins>";
                                        //    str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
                                        //}
                                        //else
                                        //{
                                        //    str = opertionData.OldValue;
                                        //}

                                        //filterProcess.EditFileStepInfos = new List<EditFileStepInfo>()
                                        //找到工步
                                        var filterStepDataMsStep = filterProcessAddStep.EditFileStepInfos?.FirstOrDefault(t => t.StepId == item._editFileList[j].StepId);
                                        if (filterStepDataMsStep != null)
                                        {


                                            //大于0 更新
                                            //editFileStepInfo = new EditFileStepInfo
                                            //{
                                            //filterStepDataMsStep.Id = opertionData.Id;
                                            //修改
                                            filterStepDataMsStep.Id = opertionData.Id;
                                            filterStepDataMsStep.StepId = opertionData.StepId.Value;
                                            filterStepDataMsStep.EditFileProcessInfoId = opertionData.ProcessId.Value;
                                            filterStepDataMsStep.NewStep = filterStepDataMsStep.NewStep;
                                            //                  filterStepDataMsStep.UniqueId = opertionData.UniqueId;
                                            filterStepDataMsStep.TWorkStepContent = opertionData.OldValue;
                                            filterStepDataMsStep.WorkStepName = WorkName;
                                            filterStepDataMsStep.WorkStepNumber = currentWork.WorkStepNumber.ToString();
                                            filterStepDataMsStep.UpdateStepContent = true;
                                            filterStepDataMsStep.WorkStepContent = opertionData.OldValue;
                                            filterStepDataMsStep.WorkStepUpdateContent = opertionData.NewValue;
                                            filterStepDataMsStep.WorkStepWorking = (int)currentWork.WorkStepWorking;
                                            //};
                                            //filterStepDataMs = editFileStepInfo;
                                        }
                                        else
                                        {
                                            editFileStepInfo = new EditFileStepInfo
                                            {
                                                //Id = opertionData.StepId.Value,
                                                Id = Guid.NewGuid(),
                                                StepId = opertionData.StepId.Value,
                                                EditFileProcessInfoId = opertionData.ProcessId.Value,
                                                NewStep = true,
                                                //                       UniqueId = opertionData.UniqueId,
                                                TWorkStepContent = str,
                                                WorkStepName = WorkName,
                                                WorkStepNumber = currentWork?.WorkStepNumber.ToString(),
                                                UpdateStepContent = true,
                                                WorkStepContent = opertionData.OldValue,
                                                WorkStepUpdateContent = opertionData.NewValue,
                                                WorkStepWorking = currentWork != null ? (int)currentWork?.WorkStepWorking : 0
                                            };
                                            if (filterProcessAddStep.EditFileStepInfos == null)
                                            {
                                                filterProcessAddStep.EditFileStepInfos = new List<EditFileStepInfo>();
                                                filterProcessAddStep.EditFileStepInfos.Add(editFileStepInfo);
                                            }
                                            else
                                            {
                                                filterProcessAddStep.EditFileStepInfos.Add(editFileStepInfo);
                                            }
                                        }
                                        //if (!string.IsNullOrEmpty(opertionData.ProcessId.ToString()) && !string.IsNullOrEmpty(opertionData.StepId.ToString()))
                                        //{
                                        //    editFileStepInfo = new EditFileStepInfo
                                        //    {
                                        //        Id = opertionData.Id,
                                        //        EditFileProcessInfoId = editFileProcessInfoId,
                                        //        NewStep = true,
                                        //        UniqueId = opertionData.UniqueId,
                                        //        TWorkStepContent = WorkName + currentWork.WorkStepContent,
                                        //        WorkStepName = WorkName,
                                        //        WorkStepNumber = currentWork.WorkStepNumber.ToString(),
                                        //        UpdateStepContent = true,
                                        //        WorkStepContent = currentWork.WorkStepContent,
                                        //        WorkStepUpdateContent = opertionData.NewValue,
                                        //        WorkStepWorking = (int)currentWork.WorkStepWorking
                                        //    };
                                        //    editFileStepInfoList.Add(editFileStepInfo);
                                        //}
                                        break;
                                    case 5:
                                        operationLog.OperationType = OperationTypes.表格删除行;
                                        var propertyDelInfo = currentWork.GetType().GetProperty(opertionData.TableFieldName);
                                        object valueDel = propertyDelInfo.GetValue(currentWork, null);
                                        dynamic dicaDel = default;
                                        foreach (var obj in ((dynamic)valueDel))
                                        {
                                            if (obj.Id == opertionData.RowId.Value)
                                            {
                                                dicaDel = obj;
                                            }
                                        }
                                        //foreach (var obj in ((dynamic)dicaDel))
                                        //{
                                        //    if (obj.Id == opertionData.RowId.Value)
                                        //    {
                                        //        dica = obj;
                                        //    }
                                        //}

                                        //先根据rowid并且 编辑表格内容的所有数据 
                                        var tableEditRowDataDel = item._editFileList.Where(t => t.RowId == opertionData.RowId && opertionData.Type == 5).ToList();
                                        //循环赋值给对象
                                        var filterDataDel = tableEditRowDataDel.Select(t => new { t.FieldName, t.OldValue, t.NewValue, t.TableFieldName, t.RowId }).ToList();
                                        var filterProcessDelTableRow = editFileProcessInfoList.FirstOrDefault(t => t.EditFileProcessId == item._editFileList[j].ProcessId);
                                        //if (filterProcessAddTable != null)
                                        //{
                                        //找到工步
                                        var filterStepDataDelRow = filterProcessDelTableRow.EditFileStepInfos?.FirstOrDefault(t => t.StepId == item._editFileList[j].StepId);
                                        if (filterStepDataDelRow != null)
                                        {
                                            //找到表
                                            var tableData = filterStepDataDelRow.EditFileTableInfos?.FirstOrDefault(t => t.EditFileStepInfoId == item._editFileList[j].StepId && t.TableFieldName == item._editFileList[j].TableFieldName);
                                            if (tableData != null)
                                            {
                                                var tableDataRow = tableData.EditFileRowInfos?.FirstOrDefault(t => t.RowId == item._editFileList[j].RowId.Value);
                                                if (tableDataRow != null)
                                                {
                                                    //存在则更新

                                                 //   tableDataRow.Id = opertionData.RowId.Value;
                                                    tableDataRow.RowId = opertionData.RowId.Value;
                                                    //                           tableDataRow.UniqueId = opertionData.UniqueId;
                                                    // tableDataRow.EditFileTableInfoId = opertionData.TableId.Value;
                                                    tableDataRow.NewRow =false;
                                                    tableDataRow.DeletedRow = true;
                                                }
                                                else
                                                {
                                                    //否则新增
                                                    editFileRowInfo = new EditFileRowInfo
                                                    {
                                                        //Id = opertionData.RowId.Value,
                                                        Id = Guid.NewGuid(),
                                                        RowId = opertionData.RowId.Value,
                                                        EditFileTableInfoId = tableData.Id,
                                                        // UniqueId = opertionData.UniqueId,
                                                        DeletedRow = true,
                                                        //      EditFileTableInfoId = opertionData.TableId.Value,
                                                        NewRow = false,
                                                    };
                                                    Dictionary<string, string> diction = new Dictionary<string, string>();
                                                    if (dicaDel != null)
                                                    {
                                                        //获取所有字段

                                                        //找到该行的全部数据添加到字典
                                                        var prop = dicaDel.GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
                                                        foreach (var ac in prop)
                                                        {
                                                            //var val =((dynamic)ac).GetValue(dica);
                                                            diction.Add(((dynamic)ac).Name, Convert.ToString(((dynamic)ac).GetValue(dicaDel)));
                                                        }
                                                    }
                                                    table.TableKey = fieldname;
                                                    table.TableName = tableFieldName;
                                                    table.FiledDesc = filedMap[table.TableName].filedValue;
                                                    table.FiledName = filedMap[table.TableName].filedKey;
                                                    ////循环赋值
                                                    //var editFileTableDataInfoByRowId = tableDataRow.EditFileTableDataInfos?.Count(t => t.EditFileRowInfoId == opertionData.RowId);
                                                    //if (editFileTableDataInfoByRowId == null || editFileTableDataInfoByRowId == 0)
                                                    //{
                                                    //    for (int i = 0; i < table.FiledDesc.Count; i++)
                                                    //    {
                                                    //        foreach (var dicStr in diction)
                                                    //        {
                                                    //            var dicKey = dicStr.Key;
                                                    //            var dicValue = dicStr.Value;
                                                    //            var tableFiled = table.FiledDesc[i].ToLower();
                                                    //            if (dicKey.ToLower() == tableFiled)
                                                    //            {

                                                    //                editFileTableDataInfo = new EditFileTableDataInfo
                                                    //                {
                                                    //                    EditFileRowInfoId = editFileRowInfo.Id,
                                                    //                    //  UniqueId = tableDataRow.UniqueId,
                                                    //                    FieldName = table.FiledDesc[i],
                                                    //                    DisplayName = table.FiledName[i],
                                                    //                    Show = true,
                                                    //                    Value = dicValue
                                                    //                };

                                                    //                tableDataRow.EditFileTableDataInfos.Add(editFileTableDataInfo);

                                                    //            }
                                                    //        }
                                                    //    }
                                                    //}
                                                    table.TableKey = fieldname;
                                                    table.TableName = tableFieldName;
                                                    table.FiledDesc = filedMap[table.TableName].filedValue;
                                                    table.FiledName = filedMap[table.TableName].filedKey;
                                                    //循环赋值
                                                    //var editFileTableDataInfoByRowId = tableDataRow.EditFileTableDataInfos?.Count(t => t.EditFileRowInfoId == opertionData.RowId);
                                                    //if (editFileTableDataInfoByRowId == null || editFileTableDataInfoByRowId == 0)
                                                    //{
                                                        for (int i = 0; i < table.FiledDesc.Count; i++)
                                                        {
                                                            string oldValue = "";
                                                            string dicKey = "";
                                                            string dicValue = "";
                                                            if (diction.Count > 0)
                                                            {
                                                                foreach (var dicStr in diction)
                                                                {
                                                                    dicKey = dicStr.Key;
                                                                    dicValue = dicStr.Value;
                                                                    bool kg = false;
                                                                    var tableFiled = table.FiledDesc[i].ToLower();
                                                                    if (dicKey.ToLower() == tableFiled)
                                                                    {
                                                                        foreach (var valueData in filterDataDel)
                                                                        {
                                                                            if (valueData.FieldName.ToLower() == dicKey.ToLower())
                                                                            {
                                                                                dicValue = valueData.NewValue;
                                                                                oldValue = valueData.OldValue;
                                                                                kg = true;
                                                                            }
                                                                        }
                                                                        EditFileTableDataInfo editFileTableDataInfo = new EditFileTableDataInfo
                                                                        {
                                                                            EditFileRowInfoId = editFileRowInfo.Id,
                                                                            //  UniqueId = tableDataRow.UniqueId,
                                                                            FieldName = table.FiledDesc[i],
                                                                            DisplayName = table.FiledName[i],
                                                                            Show = true,
                                                                            Value = kg == false ? dicValue : oldValue,
                                                                            NewValue = kg == false ? "" : dicValue
                                                                        };
                                                                        if (editFileRowInfo.EditFileTableDataInfos == null)
                                                                        {
                                                                            editFileRowInfo.EditFileTableDataInfos = new List<EditFileTableDataInfo>();
                                                                            editFileRowInfo.EditFileTableDataInfos.Add(editFileTableDataInfo);
                                                                        }
                                                                        else
                                                                        {
                                                                            editFileRowInfo.EditFileTableDataInfos.Add(editFileTableDataInfo);
                                                                        }
                                                                        //tableDataRow.EditFileTableDataInfos.Add(editFileTableDataInfo);

                                                                    }
                                                                }
                                                            }

                                                        }
                                              //      }
                                                  

                                                    if (tableData.EditFileRowInfos == null)
                                                    {
                                                        tableData.EditFileRowInfos = new List<EditFileRowInfo>();
                                                        tableData.EditFileRowInfos.Add(editFileRowInfo);
                                                    }
                                                    else
                                                    {
                                                        tableData.EditFileRowInfos.Add(editFileRowInfo);
                                                    }
                                                    // tableData.EditFileRowInfos.Add(editFileRowInfo);
                                                    //tableData.EditFileRowInfos = editFileRowInfolist;
                                                }
                                            }
                                            else
                                            {
                                                
                                                //if (tableDataRow != null)
                                                //{
                                                //    //存在则更新

                                                //    tableDataRow.Id = opertionData.RowId.Value;
                                                //    //                           tableDataRow.UniqueId = opertionData.UniqueId;
                                                //    // tableDataRow.EditFileTableInfoId = opertionData.TableId.Value;
                                                //    tableDataRow.NewRow = false;
                                                //    tableDataRow.DeletedRow = true;
                                                //}
                                                //else
                                                //{
                                                    var tableNewBool = item._editFileList.FirstOrDefault(t => t.TableFieldName == opertionData.TableFieldName && t.StepId == opertionData.StepId);
                                                    //NewTable = tableNewBool?.Type != 2 ? false : true
                                                    //否则新增
                                                    editFileTableInfo = new EditFileTableInfo
                                                    {
                                                        Id = Guid.NewGuid(),
                                                        EditFileStepInfoId = opertionData.StepId.Value,
                                                        FileProcessesId = opertionData.ProcessId.Value.ToString(),
                                                        TableFieldName = opertionData.TableFieldName,
                                                        TableName = tableFieldName,
                                                        //  UniqueId = opertionData.UniqueId,
                                                        NewTable = tableNewBool?.Type != 2 ? false : true
                                                    };
                                                    table.TableKey = fieldname;
                                                    table.TableName = tableFieldName;
                                                    table.FiledDesc = filedMap[table.TableName].filedValue;
                                                    table.FiledName = filedMap[table.TableName].filedKey;
                                                    for (int i = 0; i < table.FiledDesc.Count; i++)
                                                    {
                                                        editFileTableStrunctInfo = new EditFileTableStructInfo
                                                        {
                                                            EditFileTableInfoId = editFileTableInfo.Id,
                                                            FieldName = table.FiledDesc[i],
                                                            DisplayName = table.FiledName[i],
                                                            Index = i,
                                                            Show = true
                                                        };
                                                        editFileTableStrunctInfoList.Add(editFileTableStrunctInfo);
                                                    }
                                                    editFileTableInfo.EditFileTableStructInfos = editFileTableStrunctInfoList;
                                                    //新增表行
                                                    editFileRowInfo = new EditFileRowInfo
                                                    {
                                                        Id = Guid.NewGuid(),
                                                        RowId = opertionData.Id,
                                                        //  UniqueId = opertionData.UniqueId,
                                                        //   EditFileTableInfoId = opertionData.TableId.Value,
                                                        DeletedRow = true,
                                                        NewRow = false,
                                                    };

                                                    Dictionary<string, string> diction = new Dictionary<string, string>();
                                                    if (dicaDel != null)
                                                    {
                                                        //获取所有字段

                                                        //找到该行的全部数据添加到字典
                                                        var prop = dicaDel.GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
                                                        foreach (var ac in prop)
                                                        {
                                                            //var val =((dynamic)ac).GetValue(dica);
                                                            diction.Add(((dynamic)ac).Name, Convert.ToString(((dynamic)ac).GetValue(dicaDel)));
                                                        }
                                                    }

                                                    ////循环赋值
                                                    //var editFileTableDataInfoByRowId = tableDataRow.EditFileTableDataInfos?.Count(t => t.EditFileRowInfoId == opertionData.RowId);
                                                    //if (editFileTableDataInfoByRowId == null || editFileTableDataInfoByRowId == 0)
                                                    //{
                                                    //    for (int i = 0; i < table.FiledDesc.Count; i++)
                                                    //    {
                                                    //        foreach (var dicStr in diction)
                                                    //        {
                                                    //            var dicKey = dicStr.Key;
                                                    //            var dicValue = dicStr.Value;
                                                    //            var tableFiled = table.FiledDesc[i].ToLower();
                                                    //            if (dicKey.ToLower() == tableFiled)
                                                    //            {

                                                    //                editFileTableDataInfo = new EditFileTableDataInfo
                                                    //                {
                                                    //                    EditFileRowInfoId = editFileRowInfo.Id,
                                                    //                    //  UniqueId = tableDataRow.UniqueId,
                                                    //                    FieldName = table.FiledDesc[i],
                                                    //                    DisplayName = table.FiledName[i],
                                                    //                    Show = true,
                                                    //                    Value = dicValue
                                                    //                };

                                                    //                tableDataRow.EditFileTableDataInfos.Add(editFileTableDataInfo);

                                                    //            }
                                                    //        }
                                                    //    }
                                                    //}
                                                    table.TableKey = fieldname;
                                                    table.TableName = tableFieldName;
                                                    table.FiledDesc = filedMap[table.TableName].filedValue;
                                                    table.FiledName = filedMap[table.TableName].filedKey;
                                                    //循环赋值
                                                    //var editFileTableDataInfoByRowId = tableDataRow.EditFileTableDataInfos?.Count(t => t.EditFileRowInfoId == opertionData.RowId);
                                                    //if (editFileTableDataInfoByRowId == null || editFileTableDataInfoByRowId == 0)
                                                    //{
                                                        for (int i = 0; i < table.FiledDesc.Count; i++)
                                                        {
                                                            string oldValue = "";
                                                            string dicKey = "";
                                                            string dicValue = "";
                                                            if (diction.Count > 0)
                                                            {
                                                                foreach (var dicStr in diction)
                                                                {
                                                                    dicKey = dicStr.Key;
                                                                    dicValue = dicStr.Value;
                                                                    bool kg = false;
                                                                    var tableFiled = table.FiledDesc[i].ToLower();
                                                                    if (dicKey.ToLower() == tableFiled)
                                                                    {
                                                                        foreach (var valueData in filterDataDel)
                                                                        {
                                                                            if (valueData.FieldName.ToLower() == dicKey.ToLower())
                                                                            {
                                                                                dicValue = valueData.NewValue;
                                                                                oldValue = valueData.OldValue;
                                                                                kg = true;
                                                                            }
                                                                        }
                                                                        EditFileTableDataInfo editFileTableDataInfo = new EditFileTableDataInfo
                                                                        {
                                                                            EditFileRowInfoId = editFileRowInfo.Id,
                                                                            //  UniqueId = tableDataRow.UniqueId,
                                                                            FieldName = table.FiledDesc[i],
                                                                            DisplayName = table.FiledName[i],
                                                                            Show = true,
                                                                            Value = kg == false ? dicValue : oldValue,
                                                                            NewValue = kg == false ? "" : dicValue
                                                                        };
                                                                        if (editFileRowInfo.EditFileTableDataInfos == null)
                                                                        {
                                                                            editFileRowInfo.EditFileTableDataInfos = new List<EditFileTableDataInfo>();
                                                                            editFileRowInfo.EditFileTableDataInfos.Add(editFileTableDataInfo);
                                                                        }
                                                                        else
                                                                        {
                                                                            editFileRowInfo.EditFileTableDataInfos.Add(editFileTableDataInfo);
                                                                        }
                                                                        //tableDataRow.EditFileTableDataInfos.Add(editFileTableDataInfo);

                                                                    }
                                                                }
                                                            }

                                                        }
                                                 //   }




                                                    if (editFileTableInfo.EditFileRowInfos == null)
                                                    {
                                                        editFileTableInfo.EditFileRowInfos = new List<EditFileRowInfo>();
                                                        editFileTableInfo.EditFileRowInfos.Add(editFileRowInfo);
                                                    }
                                                    else
                                                    {
                                                        editFileTableInfo.EditFileRowInfos.Add(editFileRowInfo);
                                                    }


                                                    if (filterStepDataDelRow.EditFileTableInfos == null)
                                                    {
                                                        filterStepDataDelRow.EditFileTableInfos = new List<EditFileTableInfo>();
                                                        filterStepDataDelRow.EditFileTableInfos.Add(editFileTableInfo);
                                                    }
                                                    else
                                                    {
                                                        filterStepDataDelRow.EditFileTableInfos.Add(editFileTableInfo);
                                                    }

                                                






                                                //filterStepDataDelRow.EditFileTableInfos = editFileTableInfoList;
                                            }
                                        }
                                        else
                                        {
                                            //difValue = opertionData.NewValue.Exceptblanks().SplitHtml2().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks().SplitHtml2());
                                            //if (difValue != "")
                                            //{
                                            //    //str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
                                            //    //str = opertionData.OldValue + "<ins style='background:#e6ffe6;'><strong>" + difValue + "</strong></ins>";
                                            //    str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
                                            //}
                                            //else
                                            //{
                                            //    str = opertionData.OldValue;
                                            //}

                                            var stepNewBool = item._editFileList.Count(t => t.StepId == opertionData.StepId && t.Type == 4);
                                            //否则新增
                                            editFileStepInfo = new EditFileStepInfo
                                            {
                                                //  Id = opertionData.StepId.Value,
                                                Id = Guid.NewGuid(),
                                                StepId = opertionData.StepId.Value,
                                                EditFileProcessInfoId = opertionData.ProcessId.Value,
                                                NewStep = stepNewBool == 0 ? false : true,
                                                //                       UniqueId = opertionData.UniqueId,
                                                TWorkStepContent = opertionData.OldValue,
                                                WorkStepName = WorkName,
                                                WorkStepNumber = currentWork?.WorkStepNumber.ToString(),
                                                UpdateStepContent = true,
                                                WorkStepContent = opertionData.OldValue,
                                                WorkStepUpdateContent = opertionData.NewValue,
                                                WorkStepWorking = currentWork == null ? 0 : (int)currentWork.WorkStepWorking
                                            };
                                            var tableNewBool = item._editFileList.FirstOrDefault(t => t.TableFieldName == opertionData.TableFieldName && t.StepId == opertionData.StepId);
                                            //NewTable = tableNewBool?.Type != 2 ? false : true

                                            //否则新增
                                            editFileTableInfo = new EditFileTableInfo
                                            {
                                                Id = Guid.NewGuid(),
                                                EditFileStepInfoId = opertionData.StepId.Value,
                                                FileProcessesId = opertionData.ProcessId.Value.ToString(),
                                                TableFieldName = opertionData.TableFieldName,
                                                TableName = tableFieldName,
                                                //  UniqueId = opertionData.UniqueId,
                                                NewTable = tableNewBool?.Type != 2 ? false : true
                                            };
                                            table.TableKey = fieldname;
                                            table.TableName = tableFieldName;
                                            table.FiledDesc = filedMap[table.TableName].filedValue;
                                            table.FiledName = filedMap[table.TableName].filedKey;
                                            for (int i = 0; i < table.FiledDesc.Count; i++)
                                            {
                                                editFileTableStrunctInfo = new EditFileTableStructInfo
                                                {
                                                    EditFileTableInfoId = editFileTableInfo.Id,
                                                    FieldName = table.FiledDesc[i],
                                                    DisplayName = table.FiledName[i],
                                                    Index = i,
                                                    Show = true
                                                };
                                                editFileTableStrunctInfoList.Add(editFileTableStrunctInfo);
                                            }
                                            Dictionary<string, string> diction = new Dictionary<string, string>();
                                            if (dicaDel != null)
                                            {
                                                //获取所有字段

                                                //找到该行的全部数据添加到字典
                                                var prop = dicaDel.GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
                                                foreach (var ac in prop)
                                                {
                                                    //var val =((dynamic)ac).GetValue(dica);
                                                    diction.Add(((dynamic)ac).Name, Convert.ToString(((dynamic)ac).GetValue(dicaDel)));
                                                }
                                            }

                                            ////循环赋值
                                            //var editFileTableDataInfoByRowId = tableDataRow.EditFileTableDataInfos?.Count(t => t.EditFileRowInfoId == opertionData.RowId);
                                            //if (editFileTableDataInfoByRowId == null || editFileTableDataInfoByRowId == 0)
                                            //{
                                            //    for (int i = 0; i < table.FiledDesc.Count; i++)
                                            //    {
                                            //        foreach (var dicStr in diction)
                                            //        {
                                            //            var dicKey = dicStr.Key;
                                            //            var dicValue = dicStr.Value;
                                            //            var tableFiled = table.FiledDesc[i].ToLower();
                                            //            if (dicKey.ToLower() == tableFiled)
                                            //            {

                                            //                editFileTableDataInfo = new EditFileTableDataInfo
                                            //                {
                                            //                    EditFileRowInfoId = editFileRowInfo.Id,
                                            //                    //  UniqueId = tableDataRow.UniqueId,
                                            //                    FieldName = table.FiledDesc[i],
                                            //                    DisplayName = table.FiledName[i],
                                            //                    Show = true,
                                            //                    Value = dicValue
                                            //                };

                                            //                tableDataRow.EditFileTableDataInfos.Add(editFileTableDataInfo);

                                            //            }
                                            //        }
                                            //    }
                                            //}
                                            table.TableKey = fieldname;
                                            table.TableName = tableFieldName;
                                            table.FiledDesc = filedMap[table.TableName].filedValue;
                                            table.FiledName = filedMap[table.TableName].filedKey;
                                            //循环赋值
                                            //var editFileTableDataInfoByRowId = tableDataRow.EditFileTableDataInfos?.Count(t => t.EditFileRowInfoId == opertionData.RowId);
                                            //if (editFileTableDataInfoByRowId == null || editFileTableDataInfoByRowId == 0)
                                            //{
                                            for (int i = 0; i < table.FiledDesc.Count; i++)
                                            {
                                                string oldValue = "";
                                                string dicKey = "";
                                                string dicValue = "";
                                                if (diction.Count > 0)
                                                {
                                                    foreach (var dicStr in diction)
                                                    {
                                                        dicKey = dicStr.Key;
                                                        dicValue = dicStr.Value;
                                                        bool kg = false;
                                                        var tableFiled = table.FiledDesc[i].ToLower();
                                                        if (dicKey.ToLower() == tableFiled)
                                                        {
                                                            foreach (var valueData in filterDataDel)
                                                            {
                                                                if (valueData.FieldName.ToLower() == dicKey.ToLower())
                                                                {
                                                                    dicValue = valueData.NewValue;
                                                                    oldValue = valueData.OldValue;
                                                                    kg = true;
                                                                }
                                                            }
                                                            EditFileTableDataInfo editFileTableDataInfo = new EditFileTableDataInfo
                                                            {
                                                                EditFileRowInfoId = editFileRowInfo.Id,
                                                                //  UniqueId = tableDataRow.UniqueId,
                                                                FieldName = table.FiledDesc[i],
                                                                DisplayName = table.FiledName[i],
                                                                Show = true,
                                                                Value = kg == false ? dicValue : oldValue,
                                                                NewValue = kg == false ? "" : dicValue
                                                            };
                                                            if (editFileRowInfo.EditFileTableDataInfos == null)
                                                            {
                                                                editFileRowInfo.EditFileTableDataInfos = new List<EditFileTableDataInfo>();
                                                                editFileRowInfo.EditFileTableDataInfos.Add(editFileTableDataInfo);
                                                            }
                                                            else
                                                            {
                                                                editFileRowInfo.EditFileTableDataInfos.Add(editFileTableDataInfo);
                                                            }
                                                            //tableDataRow.EditFileTableDataInfos.Add(editFileTableDataInfo);

                                                        }
                                                    }
                                                }

                                            }
                                            //   }




                                            if (editFileTableInfo.EditFileRowInfos == null)
                                            {
                                                editFileTableInfo.EditFileRowInfos = new List<EditFileRowInfo>();
                                                editFileTableInfo.EditFileRowInfos.Add(editFileRowInfo);
                                            }
                                            else
                                            {
                                                editFileTableInfo.EditFileRowInfos.Add(editFileRowInfo);
                                            }

                                            editFileTableInfo.EditFileTableStructInfos = editFileTableStrunctInfoList;

                                            if (editFileStepInfo.EditFileTableInfos == null)
                                            {
                                                editFileStepInfo.EditFileTableInfos = new List<EditFileTableInfo>();
                                                editFileStepInfo.EditFileTableInfos.Add(editFileTableInfo);
                                            }
                                            else
                                            {
                                                editFileStepInfo.EditFileTableInfos.Add(editFileTableInfo);
                                            }
                                            if (filterProcessDelTableRow.EditFileStepInfos == null)
                                            {
                                                filterProcessDelTableRow.EditFileStepInfos = new List<EditFileStepInfo>();
                                                filterProcessDelTableRow.EditFileStepInfos.Add(editFileStepInfo);
                                            }
                                            else
                                            {
                                                filterProcessDelTableRow.EditFileStepInfos.Add(editFileStepInfo);
                                            }
                                        }
                                        break;
                                    case 6:
                                        operationLog.OperationType = OperationTypes.删除表;
                                        //找到表上的工步
                                        var filterProcessDelTable = editFileProcessInfoList.FirstOrDefault(t => t.EditFileProcessId == item._editFileList[j].ProcessId);
                                        //if (filterProcessAddTable != null)
                                        //{
                                        //找到工步
                                        var filterStepDataDelTable = filterProcessDelTable.EditFileStepInfos?.FirstOrDefault(t => t.StepId == item._editFileList[j].StepId);

                                        if (filterStepDataDelTable != null)
                                        {
                                            //找到表
                                            var tableData = filterStepDataDelTable.EditFileTableInfos?.FirstOrDefault(t => t.EditFileStepInfoId == item._editFileList[j].StepId && t.TableFieldName == item._editFileList[j].TableFieldName);
                                            if (tableData != null)
                                            {
                                                //大于0 更新
                                                editFileTableInfo = new EditFileTableInfo
                                                {
                                                    Id = Guid.NewGuid(),
                                                    EditFileStepInfoId = opertionData.StepId.Value,
                                                    FileProcessesId = opertionData.ProcessId.Value.ToString(),
                                                    TableFieldName = opertionData.TableFieldName,
                                                    TableName = tableFieldName,
                                                    //                           UniqueId = opertionData.UniqueId,
                                                    NewTable = false,
                                                    DeletedTable = true
                                                };
                                                tableData = editFileTableInfo;
                                            }
                                            else
                                            {
                                                //否则新增
                                                editFileTableInfo = new EditFileTableInfo
                                                {
                                                    Id = Guid.NewGuid(),
                                                    EditFileStepInfoId = opertionData.StepId.Value,
                                                    FileProcessesId = opertionData.ProcessId.Value.ToString(),
                                                    TableFieldName = opertionData.TableFieldName,
                                                    TableName = tableFieldName,
                                                    //  UniqueId = opertionData.UniqueId,
                                                    NewTable = false,
                                                    DeletedTable = true
                                                };
                                                table.TableKey = fieldname;
                                                table.TableName = tableFieldName;
                                                table.FiledDesc = filedMap[table.TableName].filedValue;
                                                table.FiledName = filedMap[table.TableName].filedKey;
                                                for (int i = 0; i < table.FiledDesc.Count; i++)
                                                {
                                                    editFileTableStrunctInfo = new EditFileTableStructInfo
                                                    {
                                                        EditFileTableInfoId = editFileTableInfo.Id,
                                                        FieldName = table.FiledDesc[i],
                                                        DisplayName = table.FiledName[i],
                                                        Index = i,
                                                        Show = true
                                                    };
                                                    editFileTableStrunctInfoList.Add(editFileTableStrunctInfo);
                                                }
                                                editFileTableInfo.EditFileTableStructInfos = editFileTableStrunctInfoList;

                                                if (filterStepDataDelTable.EditFileTableInfos == null)
                                                {
                                                    filterStepDataDelTable.EditFileTableInfos = new List<EditFileTableInfo>();
                                                    filterStepDataDelTable.EditFileTableInfos.Add(editFileTableInfo);
                                                }
                                                else
                                                {
                                                    filterStepDataDelTable.EditFileTableInfos.Add(editFileTableInfo);
                                                }
                                            }
                                        }
                                        else
                                        {
                                            var stepNewBool = item._editFileList.Count(t => t.StepId == opertionData.StepId && t.Type == 4);
                                            //difValue = opertionData.NewValue.Exceptblanks().SplitHtml2().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks().SplitHtml2());
                                            //if (difValue != "")
                                            //{
                                            //    //str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
                                            //    //str = opertionData.OldValue + "<ins style='background:#e6ffe6;'><strong>" + difValue + "</strong></ins>";
                                            //    str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
                                            //}
                                            //else
                                            //{
                                            //    str = opertionData.OldValue;
                                            //}

                                            editFileStepInfo = new EditFileStepInfo
                                            {
                                             //   Id = opertionData.StepId.Value,
                                             Id =Guid.NewGuid(),
                                                StepId = opertionData.StepId.Value,
                                                EditFileProcessInfoId = opertionData.ProcessId.Value,
                                                NewStep = stepNewBool == 0 ? false : true,

                                                //                         UniqueId = opertionData.UniqueId,
                                                TWorkStepContent = opertionData.OldValue,
                                                WorkStepName = WorkName,
                                                WorkStepNumber = currentWork.WorkStepNumber.ToString(),
                                                UpdateStepContent = true,
                                                WorkStepContent = opertionData.OldValue,
                                                WorkStepUpdateContent = opertionData.NewValue,
                                                WorkStepWorking = (int)currentWork.WorkStepWorking
                                            };
                                            editFileTableInfo = new EditFileTableInfo
                                            {
                                                Id = Guid.NewGuid(),
                                                EditFileStepInfoId = opertionData.StepId.Value,
                                                FileProcessesId = opertionData.ProcessId.Value.ToString(),
                                                TableFieldName = opertionData.TableFieldName,
                                                TableName = tableFieldName,
                                                //                      UniqueId = opertionData.UniqueId,
                                                NewTable = false,
                                                DeletedTable = true
                                            };
                                            table.TableKey = fieldname;
                                            table.TableName = tableFieldName;
                                            table.FiledDesc = filedMap[table.TableName].filedValue;
                                            table.FiledName = filedMap[table.TableName].filedKey;
                                            for (int i = 0; i < table.FiledDesc.Count; i++)
                                            {
                                                editFileTableStrunctInfo = new EditFileTableStructInfo
                                                {
                                                    EditFileTableInfoId = editFileTableInfo.Id,
                                                    FieldName = table.FiledDesc[i],
                                                    DisplayName = table.FiledName[i],
                                                    Index = i,
                                                    Show = true
                                                };
                                                editFileTableStrunctInfoList.Add(editFileTableStrunctInfo);
                                            }

                                            //foreach (string str in table.FiledDesc)
                                            //{

                                            //    foreach (string str2 in table.FiledName)
                                            //    {
                                            //        editFileTableStrunctInfo = new EditFileTableStructInfo
                                            //        {
                                            //            FieldName = str,
                                            //            DisplayName = str2
                                            //        };
                                            //        editFileTableStrunctInfoList.Add(editFileTableStrunctInfo);
                                            //        break;
                                            //    }
                                            //}
                                            //否则新增
                                            //否则新增

                                            editFileTableInfo.EditFileTableStructInfos = editFileTableStrunctInfoList;


                                            if (editFileStepInfo.EditFileTableInfos == null)
                                            {
                                                editFileStepInfo.EditFileTableInfos = new List<EditFileTableInfo>();
                                                editFileStepInfo.EditFileTableInfos.Add(editFileTableInfo);
                                            }
                                            else
                                            {
                                                editFileStepInfo.EditFileTableInfos.Add(editFileTableInfo);
                                            }
                                            if (filterProcessDelTable.EditFileStepInfos == null)
                                            {
                                                filterProcessDelTable.EditFileStepInfos = new List<EditFileStepInfo>();
                                                filterProcessDelTable.EditFileStepInfos.Add(editFileStepInfo);
                                            }
                                            else
                                            {
                                                filterProcessDelTable.EditFileStepInfos.Add(editFileStepInfo);
                                            }

                                            //editFileTableInfoList.Add(editFileTableInfo);
                                            //editFileStepInfo.EditFileTableInfos = editFileTableInfoList;
                                            //editFileStepInfoList.Add(editFileStepInfo);
                                            //filterProcessDelTable.EditFileStepInfos = editFileStepInfoList;
                                        }

                                        break;
                                    case 7:
                                        operationLog.OperationType = OperationTypes.删除工步;

                                        var filterProcessDelStep = editFileProcessInfoList.FirstOrDefault(t => t.EditFileProcessId == item._editFileList[j].ProcessId);
                                        //filterProcess.EditFileStepInfos = new List<EditFileStepInfo>()
                                        //找到工步
                                        var filterStepDataDelStep = filterProcessDelStep.EditFileStepInfos?.FirstOrDefault(t => t.StepId == item._editFileList[j].StepId);
                                        if (filterStepDataDelStep != null)
                                        {
                                            //修改
                                            //大于0 更新
                                            //editFileStepInfo = new EditFileStepInfo
                                            //{
                                            // filterStepDataDelStep.Id = opertionData.Id;
                                            filterStepDataDelStep.StepId = opertionData.Id;
                                            filterStepDataDelStep.EditFileProcessInfoId = editFileProcessInfoId;
                                            filterStepDataDelStep.NewStep = false;
                                            filterStepDataDelStep.DeletedStep = true;
                                            //                      filterStepDataDelStep.UniqueId = opertionData.UniqueId;
                                            filterStepDataDelStep.TWorkStepContent = opertionData.NewValue;
                                            filterStepDataDelStep.WorkStepName = WorkName;
                                            filterStepDataDelStep.WorkStepNumber = currentWork == null ? queryStepEntity.WorkStepNumber.ToString() : currentWork.WorkStepNumber.ToString();
                                            filterStepDataDelStep.UpdateStepContent = true;
                                            filterStepDataDelStep.WorkStepContent = opertionData.OldValue;
                                            filterStepDataDelStep.WorkStepUpdateContent = opertionData.NewValue;
                                            filterStepDataDelStep.WorkStepWorking = currentWork == null ? 0 : (int)currentWork.WorkStepWorking;
                                            //};
                                            //filterStepDataMs = editFileStepInfo;
                                        }
                                        else
                                        {
                                            editFileStepInfo = new EditFileStepInfo
                                            {
                                                //Id = opertionData.StepId.Value,
                                                Id = Guid.NewGuid(),
                                                StepId = opertionData.StepId.Value,
                                                EditFileProcessInfoId = opertionData.ProcessId.Value,
                                                NewStep = false,
                                                DeletedStep = true,
                                                //                       UniqueId = opertionData.UniqueId,
                                                TWorkStepContent = opertionData.NewValue,
                                                WorkStepName = WorkName,
                                                WorkStepNumber = currentWork == null ? queryStepEntity.WorkStepNumber.ToString() : currentWork.WorkStepNumber.ToString(),
                                                UpdateStepContent = true,
                                                WorkStepContent = opertionData.OldValue,
                                                WorkStepUpdateContent = opertionData.NewValue,
                                                WorkStepWorking = currentWork == null ? 0 : (int)currentWork.WorkStepWorking
                                            };
                                            if (filterProcessDelStep.EditFileStepInfos == null)
                                            {
                                                filterProcessDelStep.EditFileStepInfos = new List<EditFileStepInfo>();
                                                filterProcessDelStep.EditFileStepInfos.Add(editFileStepInfo);
                                            }
                                            else
                                            {
                                                filterProcessDelStep.EditFileStepInfos.Add(editFileStepInfo);
                                            }
                                            //filterProcessDelStep.EditFileStepInfos.Add(editFileStepInfo);
                                        }
                                        break;
                                    case 8:
                                        operationLog.OperationType = OperationTypes.编辑工序描述;
                                        if (string.IsNullOrEmpty(opertionData.StepId.ToString()))
                                        {
                                            var filterProcessAdd = editFileProcessInfoList.FirstOrDefault(t => t.EditFileProcessId == item._editFileList[j].ProcessId);

                                            if (filterProcessAdd != null)
                                            {
                                                //difValue = opertionData.NewValue.Exceptblanks().SplitHtml2().TellingDifferencesFrom(opertionData.OldValue.Exceptblanks().SplitHtml2());
                                                //if (difValue != "")
                                                //{
                                                //    //str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
                                                //    //str = opertionData.OldValue + "<ins style='background:#e6ffe6;'><strong>" + difValue + "</strong></ins>";
                                                //    str = "<del>" + opertionData.OldValue + "</del>" + "<ins style=\"background:#e6ffe6;\"><strong>" + opertionData.NewValue + "</strong></ins>";
                                                //}
                                                //else
                                                //{
                                                //    str = opertionData.OldValue;
                                                //}


                                                //var processData = ReturnBopTaskOutDto.TechniqueTask.ProcessesListDto.Where(d => d.Id == editFileProcessInfoId).FirstOrDefault();
                                                var processData = item._editFileList.FirstOrDefault(t => t.ProcessId == opertionData.ProcessId && t.StepId == null);
                                                if (processData != null)
                                                {

                                                    filterProcessAdd.ProcessesName = currentPro.ProcessesName.ToString();
                                                    filterProcessAdd.ProcessesSequence = currentPro.ProcessesSequence;
                                                    filterProcessAdd.ProcessesCharacteristic = currentPro.ProcessesCharacteristic;
                                                    filterProcessAdd.ProcessesExplain = processData.OldValue;
                                                    filterProcessAdd.UpdateProcessesExplain = opertionData.NewValue;
                                                    filterProcessAdd.UpdateProcessContent = true;
                                                    //editFileProcessInfoList.Add(editFileProcessInfo);
                                                }
                                                //editFileProcessInfo.EditFileStepInfos = editFileStepInfoList;
                                            }
                                        }
                                        //else
                                        //{
                                        //    if (editFileProcessInfoList.Count == 0)
                                        //    {
                                        //        editFileProcessInfo = new EditFileProcessInfo
                                        //        {
                                        //            Id = currentPro.Id,
                                        //            EditFileProcessId = currentPro.Id,
                                        //            UniqueId = item._editFileList[j].UniqueId,
                                        //            ProcessesName = currentPro.ProcessesSequence.ToString(),
                                        //            ProcessesSequence = currentPro.ProcessesSequence,
                                        //            ProcessesCharacteristic = currentPro.ProcessesCharacteristic,
                                        //            ProcessesExplain = currentPro.ProcessesExplain,
                                        //            UpdateProcessesExplain = "",
                                        //            UpdateProcessContent = false
                                        //        };
                                        //        editFileProcessInfo.EditFileStepInfos = editFileStepInfoList;
                                        //        editFileProcessInfoList.Add(editFileProcessInfo);
                                        //    }

                                        //}

                                        break;
                                    case 9:
                                        operationLog.OperationType = OperationTypes.编辑文件描述;
                                        break;
                                    case 10:
                                        operationLog.OperationType = OperationTypes.编辑是否多媒体;
                                        break;
                                    default:
                                        operationLog.OperationType = OperationTypes.默认修改;
                                        break;
                                }
                                //  _operationHistoryRepository.Insert(operationLog);
                            }
                            item.Id = Guid.NewGuid();
                            item.EditFileProcessInfos=editFileProcessInfoList;
                            await _editFileProcessRepository.InsertAsync(item);
                            //后期扩展多条 暂用break
                            //break;
                        }
                    }
                    catch (Exception ex)
                    {

                        ConfigHelper.CreateLogText(ex.ToString());
                    }
                    //   }
                }
                if (ReturnBopTaskOutDto.fileProcessOperationLogs != null)
                {
                    ReturnBopTaskOutDto.fileProcessOperationLogs = ReturnBopTaskOutDto.fileProcessOperationLogs.OrderBy(d => d.creationTime).ToList();
                    for (int j = 0; j < ReturnBopTaskOutDto.fileProcessOperationLogs.Count; j++)
                    {
                        var currentPro = ReturnBopTaskOutDto.TechniqueTask.ProcessesListDto.FirstOrDefault(d => d.Id == ReturnBopTaskOutDto.fileProcessOperationLogs[j].processId);
                        WorkStepReturnDto currentWork = new WorkStepReturnDto();
                        if (currentPro != null)
                        {
                            currentWork = currentPro.WorkStepListDto.FirstOrDefault(d => d.Id == ReturnBopTaskOutDto.fileProcessOperationLogs[j].stepId);
                        }
                        TableNameDictionary dic = new TableNameDictionary();
                        string tableFieldName = ReturnBopTaskOutDto.fileProcessOperationLogs[j].tableDisplayName;
                        string fieldname = ReturnBopTaskOutDto.fileProcessOperationLogs[j].fieldDisplayName;
                        string ProName = "";
                        string WorkName = "";
                        if (currentPro != null)
                        {
                            ProName = "工序" + currentPro.ProcessesSequence.ToString();
                        }
                        if (currentWork != null)
                        {
                            WorkName = "工步" + currentWork.WorkStepNumber.ToString();
                        }
                        //foreach (KeyValuePair<string, FiledNodeMap> kvp in filedMap)
                        //{
                        //    string tempStr = ReturnBopTaskOutDto.fileProcessOperationLogs[j].tableFieldName;
                        //    if (!string.IsNullOrEmpty(tempStr))
                        //    {
                        //        if (kvp.Value.filedNodeDto.ToLower() == tempStr.ToLower())
                        //        {
                        //            tableFieldName = kvp.Key;
                        //            int index = kvp.Value.filedValue.IndexOf(char.ToLower(tempStr[0]) + tempStr.Substring(1));
                        //            if (index != -1)
                        //            {
                        //                fieldname = kvp.Value.filedKey[index];
                        //            }
                        //        }
                        //    }
                        //}
                        OperationLog operationLog = new OperationLog();
                        operationLog.BusinessId = techniqueList.Id;
                        operationLog.BusinessType = BusinessTypes.Bop质量执行记录;
                        if (ReturnBopTaskOutDto.fileProcessOperationLogs[j].creatorUserId != null)
                        {
                            string userName = "";
                            user = userList.FirstOrDefault(d => d.Id == ReturnBopTaskOutDto.fileProcessOperationLogs[j].creatorUserId.Value);
                            if (user != null)
                            {
                                userName = user.Surname + user.Name;
                                operationLog.UserName = userName;
                            }
                            operationLog.UserId = ReturnBopTaskOutDto.fileProcessOperationLogs[j].creatorUserId;
                        }

                        switch (ReturnBopTaskOutDto.fileProcessOperationLogs[j].type)
                        {
                            case 0:
                                operationLog.OperationType = OperationTypes.编辑表格内容;
                                operationLog.Content = ProName + "-" + WorkName + tableFieldName + "编辑表格内容" + fieldname + ",原数据为:" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].oldValue + "修改为：" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].newValue;
                                break;
                            case 1:
                                operationLog.OperationType = OperationTypes.表格添加行;
                                operationLog.Content = ProName + "-" + WorkName + tableFieldName + "表格添加行" + fieldname + ",添加数据为:" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].newValue;
                                break;
                            case 2:
                                operationLog.OperationType = OperationTypes.添加表;
                                operationLog.Content = ProName + "-" + WorkName + ",添加表:" + tableFieldName;
                                break;
                            case 3:
                                operationLog.OperationType = OperationTypes.编辑工步描述;
                                operationLog.Content = ProName + "编辑工步描述" + WorkName + ",原工步描述:" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].oldValue + "修改为：" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].newValue;
                                break;
                            case 4:
                                operationLog.OperationType = OperationTypes.新增工步;
                                operationLog.Content = ProName + "新增工步" + WorkName;
                                break;
                            case 5:
                                operationLog.OperationType = OperationTypes.表格删除行;
                                operationLog.Content = ProName + "-" + WorkName + tableFieldName + "表格删除行" + fieldname + ",删除数据为:" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].newValue;
                                break;
                            case 6:
                                operationLog.OperationType = OperationTypes.删除表;
                                operationLog.Content = ProName + "-" + WorkName + ",删除表:" + tableFieldName;
                                break;
                            case 7:
                                operationLog.OperationType = OperationTypes.删除工步;
                                operationLog.Content = ProName + "删除工步" + WorkName;
                                break;
                            case 8:
                                operationLog.OperationType = OperationTypes.编辑状态下编辑表格内容;
                                operationLog.Content = "编辑状态下编辑表格内容:" + fieldname + ",原数据为:" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].oldValue + "修改为：" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].newValue;
                                break;
                            case 9:
                                operationLog.OperationType = OperationTypes.编辑状态下批量编辑表格内容;
                                operationLog.Content = "编辑状态下批量编辑表格内容:" + fieldname + ",原数据为:" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].oldValue + "修改为：" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].newValue;
                                break;
                            case 10:
                                operationLog.OperationType = OperationTypes.编辑现场异常记录;
                                operationLog.Content = ProName + "-" + WorkName + tableFieldName + "编辑现场异常记录";
                                break;
                            case 11:
                                operationLog.OperationType = OperationTypes.打开文件;
                                operationLog.Content = "打开文件";
                                break;
                            case 12:
                                operationLog.OperationType = OperationTypes.锁定行;
                                operationLog.Content = ProName + "-" + WorkName + ReturnBopTaskOutDto.fileProcessOperationLogs[j].tableDisplayName + "锁定行";
                                break;
                            case 13:
                                operationLog.OperationType = OperationTypes.解除锁定行;
                                operationLog.Content = ProName + "-" + WorkName + ReturnBopTaskOutDto.fileProcessOperationLogs[j].tableDisplayName + "解除锁定行";
                                break;
                            case 14:
                                operationLog.OperationType = OperationTypes.锁定工步;
                                operationLog.Content = ProName + "锁定工步" + WorkName;
                                break;
                            case 15:
                                operationLog.OperationType = OperationTypes.解除锁定工步;
                                operationLog.Content = ProName + "解除锁定工步" + WorkName;
                                break;
                            case 16:
                                operationLog.OperationType = OperationTypes.取消三检;
                                operationLog.Content = ProName + "-" + WorkName + ReturnBopTaskOutDto.fileProcessOperationLogs[j].tableDisplayName + "取消三检";
                                break;
                            case 17:
                                operationLog.OperationType = OperationTypes.升版;
                                operationLog.Content = ReturnBopTaskOutDto.TechniqueTask.TechniqueNumber + "升版";
                                break;
                            default:
                                operationLog.OperationType = OperationTypes.默认修改;
                                operationLog.Content = ProName + "默认修改";
                                break;
                        }
                        _operationHistoryRepository.Insert(operationLog);
                    }
                }
                if (ReturnBopTaskOutDto.ClearSignatureRecord != null)
                {
                    foreach (var item in ReturnBopTaskOutDto.ClearSignatureRecord)
                    {
                        var guida = item.FileId.ToString().ToUpper();

                        deleteClearSignatureRecord(Guid.Parse(guida));
                        item.RTechniqueEntityId = techniqueReturnId;
                        //item.CreatorUserId = userList.FirstOrDefault(s => s.UserName == item.CreatorUserName).Id;
                        user = userList.FirstOrDefault(s => s.UserName == item.CreatorUserName);
                        if (user != null)
                        {
                            item.CreatorUserId = user.Id;
                        }
                        _clearSignatureRecordRepository.Insert(item);
                    }
                }
                return "true";
            }
            catch (Exception ex)
            {
                
                message = ex.ToString();
                ConfigHelper.CreateLogText(message);
                return message;
            }
     

        }


        //public void ss()
        //{
        //    try
        //    {
        //        string path = @"D:\vsproject\camc\src\Camc.Quality.Web.Host/wwwroot/BopUploadFile/CZ-7_Y5/20220322/GCZG0-0S57360Z3/GCZG0-0S57360Z3/GCZG0-0S57360Z3.json";
        //        var jsonStr = ReadJson.GetFileJson(path);
        //        var ReturnBopTaskOutDto = JsonConvert.DeserializeObject<ReturnBopTaskOutDto>(jsonStr);
        //    }
        //    catch (Exception EX)
        //    {

        //        Console.WriteLine(EX.Message);

        //    }

        //}
        [UnitOfWork(false)]
        private void DelData(List<RTableBase> rTableBases, List<RLoadPieceEntity> rLoadPieceEntities, List<RMakeResourcesEntity> rMakeResourcesEntities, List<RVideoEntity> rVideoEntities, Guid? id)
        {
            if (id != null)
            {
                var rTechList = _rTechniqueEntityRepository.GetAll().Where(s => s.Id == id);
                if (rTechList.Count() > 0)
                {
                    _rTechniqueEntityRepository.GetDbContext().Database.AutoTransactionsEnabled = false;
                    _rTechniqueEntityRepository.GetDbContext().Database.CurrentTransaction?.Dispose();
                    var tran = _rTechniqueEntityRepository.GetDbContext().Database.BeginTransaction();
                    try
                    {
                        _rTechniqueEntityRepository.GetDbContext().Database.SetCommandTimeout(600);

                        var parameter = new SqlParameter("Id", id.ToString().ToUpper());
                        _rTechniqueEntityRepository.GetDbContext().Database.ExecuteSqlCommand("delete from RTechniqueEntities where Id =@Id", parameter);
                        tran.Commit();
                        //_rTableBaseEntity.GetDbContext().SaveChanges();
                        //  await _rTableBaseEntity.GetDbContext().BulkInsertAsync(ReturnBopTaskOutDto.rTableBases); ;
                        // tran.Dispose();
                    }
                    catch (Exception ex)
                    {
                        tran.Rollback();
                    }
                    finally
                    {
                        //   tran.Dispose();
                    }
                }
                var rProcess = _RprocessesRepository.GetAll().Where(s => s.RTechniqueEntityId == id);
                if (rProcess.Count() > 0)
                {
                    _RprocessesRepository.GetDbContext().Database.AutoTransactionsEnabled = false;
                    _RprocessesRepository.GetDbContext().Database.CurrentTransaction?.Dispose();
                    var tran = _RprocessesRepository.GetDbContext().Database.BeginTransaction();
                    try
                    {
                        _RprocessesRepository.GetDbContext().Database.SetCommandTimeout(600);

                        var parameter = new SqlParameter("Id", id.ToString().ToUpper());
                        _RprocessesRepository.GetDbContext().Database.ExecuteSqlCommand("delete from RProcessesEntities where RTechniqueEntityId =@Id", parameter);
                        tran.Commit();
                        //_rTableBaseEntity.GetDbContext().SaveChanges();
                        //  await _rTableBaseEntity.GetDbContext().BulkInsertAsync(ReturnBopTaskOutDto.rTableBases); ;
                        // tran.Dispose();
                    }
                    catch (Exception ex)
                    {
                        tran.Rollback();
                    }
                    finally
                    {
                        //   tran.Dispose();
                    }
                }
                var rWorkStep = _RWorkStepRepository.GetAll().Where(s => s.RTechniqueEntityId == id);
                if (rWorkStep.Count() > 0)
                {
                    _RWorkStepRepository.GetDbContext().Database.AutoTransactionsEnabled = false;
                    _RWorkStepRepository.GetDbContext().Database.CurrentTransaction?.Dispose();
                    var tran = _RWorkStepRepository.GetDbContext().Database.BeginTransaction();
                    try
                    {
                        _RWorkStepRepository.GetDbContext().Database.SetCommandTimeout(600);

                        var parameter = new SqlParameter("Id", id.ToString().ToUpper());
                        _RWorkStepRepository.GetDbContext().Database.ExecuteSqlCommand("delete from RWorkStepEntities where RTechniqueEntityId =@Id", parameter);
                        tran.Commit();
                        //_rTableBaseEntity.GetDbContext().SaveChanges();
                        //  await _rTableBaseEntity.GetDbContext().BulkInsertAsync(ReturnBopTaskOutDto.rTableBases); ;
                        // tran.Dispose();
                    }
                    catch (Exception ex)
                    {
                        tran.Rollback();
                    }
                    finally
                    {
                        //   tran.Dispose();
                    }
                }
                var operationHistory = _operationHistoryRepository.GetAll().Where(s => s.BusinessId == id);
                if (operationHistory.Count() > 0)
                {
                    _operationHistoryRepository.GetDbContext().Database.AutoTransactionsEnabled = false;
                    _operationHistoryRepository.GetDbContext().Database.CurrentTransaction?.Dispose();
                    var tran = _operationHistoryRepository.GetDbContext().Database.BeginTransaction();
                    try
                    {
                        _operationHistoryRepository.GetDbContext().Database.SetCommandTimeout(600);
                        var parameter = new SqlParameter("Id", id.ToString().ToUpper());
                        _operationHistoryRepository.GetDbContext().Database.ExecuteSqlCommand("delete from OperationHistorys where BusinessId =@Id", parameter);
                        tran.Commit();
                        //_rTableBaseEntity.GetDbContext().SaveChanges();
                        //  await _rTableBaseEntity.GetDbContext().BulkInsertAsync(ReturnBopTaskOutDto.rTableBases); ;
                        // tran.Dispose();
                    }
                    catch (Exception ex)
                    {
                        tran.Rollback();
                    }
                    finally
                    {
                        //   tran.Dispose();
                    }
                }
                //await _rTechniqueEntityRepository.HardDeleteAsync(d => d.Id == tempTech.Id);
                //await _RprocessesRepository.HardDeleteAsync(d => d.RTechniqueEntityId == tempTech.Id);
                //await _RWorkStepRepository.HardDeleteAsync(d => d.RTechniqueEntityId == tempTech.Id);
                //await _operationHistoryRepository.HardDeleteAsync(d => d.BusinessId == tempTech.Id);
            }
            if (rTableBases.Count > 0)
            {
                _rTableBaseEntity.GetDbContext().Database.AutoTransactionsEnabled = false;
                _rTableBaseEntity.GetDbContext().Database.CurrentTransaction?.Dispose();
                var tran = _rTableBaseEntity.GetDbContext().Database.BeginTransaction();
                try
                {
                    _rTableBaseEntity.GetDbContext().Database.SetCommandTimeout(1200);
                    foreach (var item in rTableBases)
                    {
                        var parameter = new SqlParameter("Id", item.Id.ToString().ToUpper());
                        _rTableBaseEntity.GetDbContext().Database.ExecuteSqlCommand("delete from RFormBases where Id =@Id", parameter);
                    }
                    tran.Commit();
                    //_rTableBaseEntity.GetDbContext().SaveChanges();
                    //  await _rTableBaseEntity.GetDbContext().BulkInsertAsync(ReturnBopTaskOutDto.rTableBases); ;
                    // tran.Dispose();
                }
                catch (Exception ex)
                {
                    tran.Rollback();
                }
                finally
                {
                    //   tran.Dispose();
                }
            }
            if (rLoadPieceEntities.Count > 0)
            {
                _loadPieceRepository.GetDbContext().Database.AutoTransactionsEnabled = false;
                _loadPieceRepository.GetDbContext().Database.CurrentTransaction?.Dispose();
                var tran = _loadPieceRepository.GetDbContext().Database.BeginTransaction();
                try
                {
                    _loadPieceRepository.GetDbContext().Database.SetCommandTimeout(1200);
                    foreach (var item in rLoadPieceEntities)
                    {
                        var parameter = new SqlParameter("Id", item.Id.ToString().ToUpper());
                        _loadPieceRepository.GetDbContext().Database.ExecuteSqlCommand("delete from RLoadPieceEntities  where Id =@Id", parameter);
                        // await _rLoadPieceRepository.HardDeleteAsync(item);
                    }
                    tran.Commit();
                    //await _rLoadPieceRepository.GetDbContext().BulkInsertAsync(ReturnBopTaskOutDto.RLoadPieceEntities); ;

                }
                catch (Exception ex)
                {
                    tran.Rollback();
                }
                finally
                {
                    //tran.Dispose();

                }
            }
            if (rMakeResourcesEntities.Count > 0)
            {
                _makeResourcesEntityRepository.GetDbContext().Database.AutoTransactionsEnabled = false;
                _makeResourcesEntityRepository.GetDbContext().Database.CurrentTransaction?.Dispose();
                var tran = _makeResourcesEntityRepository.GetDbContext().Database.BeginTransaction();
                try
                {
                    _makeResourcesEntityRepository.GetDbContext().Database.SetCommandTimeout(1200);
                    foreach (var item in rMakeResourcesEntities)
                    {
                        var parameter = new SqlParameter("Id", item.Id.ToString().ToUpper());

                        _makeResourcesEntityRepository.GetDbContext().Database.ExecuteSqlCommand("delete from RMakeResourcesEntity  where Id =@Id", parameter);

                        //    // await _rMakeResourcesEntityRepository.HardDeleteAsync(item);
                    }
                    tran.Commit();
                }
                catch (Exception ex)
                {
                    tran.Rollback();

                }
                finally
                {
                    //   tran.Dispose();
                }
            }

            if (rVideoEntities.Count > 0)
            {
                _videoEntityRepository.GetDbContext().Database.AutoTransactionsEnabled = false;
                _videoEntityRepository.GetDbContext().Database.CurrentTransaction?.Dispose();
                var tran = _videoEntityRepository.GetDbContext().Database.BeginTransaction();

                try
                {
                    _videoEntityRepository.GetDbContext().Database.SetCommandTimeout(1200);
                    foreach (var item in rVideoEntities)
                    {
                        var parameter = new SqlParameter("Id", item.Id.ToString().ToUpper());
                        _videoEntityRepository.GetDbContext().Database.ExecuteSqlCommand("delete from RVideoEntity where Id =@Id", parameter);
                        tran.Commit();
                        //tran.Dispose();
                    }
                }
                catch (Exception ex)
                {
                    tran.Rollback();
                }
                finally
                {
                    //  tran.Dispose();
                }
            }

        }

        /// <summary>
        /// 回传变更导入日志
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        //在PAD端未更新之前，该方法用原来的
        [UnitOfWork(false)]
        public async Task<string> BatchAnalyJson(BackTaskInput input)//BackTaskInput input
        {
            List<RTableBase> tempWorkList = new List<RTableBase>(); List<RLoadPieceEntity> tempLoadList = new List<RLoadPieceEntity>(); List<RMakeResourcesEntity> tempMakeList = new List<RMakeResourcesEntity>(); List<RVideoEntity> tempVideoList = new List<RVideoEntity>();
            string message = "";
            if (input.BackTask.Count > 0)
            {

                for (int i = 0; i < input.BackTask.Count; i++)
                {
                    var tempTask = input.BackTask[i];
                    var tempTech = await _rTechniqueEntityRepository.FirstOrDefaultAsync(c => c.TechniqueNumber == tempTask.TechniqueNum);
                    if (tempTech != null)
                    {
                        using (var unitofwork = _unitOfWorkManager.Begin(System.Transactions.TransactionScopeOption.RequiresNew))
                        {
                            //await _rTechniqueEntityRepository.HardDeleteAsync(d => d.Id == tempTech.Id);
                            //await _RprocessesRepository.HardDeleteAsync(d => d.RTechniqueEntityId == tempTech.Id);
                            tempWorkList = (from temp1 in _RWorkStepRepository.GetAll().Where(d => d.RTechniqueEntityId == tempTech.Id)
                                            join temp2 in _rTableBaseEntity.GetAllIncluding(a => a.RecordRequirements, b => b.InspectionSignature, c => c.MeasuredResult, d => d.Environment, e => e.MultiMedia) on temp1.Id equals temp2.RWorkStepEntityId
                                            select temp2).ToList();
                            tempLoadList = (from temp1 in _RWorkStepRepository.GetAll().Where(d => d.RTechniqueEntityId == tempTech.Id)
                                            join temp2 in _loadPieceRepository.GetAll() on temp1.Id equals temp2.RWorkStepEntityId
                                            select temp2).ToList();
                            tempMakeList = (from temp1 in _RWorkStepRepository.GetAll().Where(d => d.RTechniqueEntityId == tempTech.Id)
                                            join temp2 in _makeResourcesEntityRepository.GetAll() on temp1.Id equals temp2.RWorkStepEntityId
                                            select temp2).ToList();
                            tempVideoList = (from temp1 in _RWorkStepRepository.GetAll().Where(d => d.RTechniqueEntityId == tempTech.Id)
                                             join temp2 in _videoEntityRepository.GetAll() on temp1.Id equals temp2.RWorkStepEntityId
                                             select temp2).ToList();
                            //await _RWorkStepRepository.HardDeleteAsync(d => d.RTechniqueEntityId == tempTech.Id);
                            //await _operationHistoryRepository.HardDeleteAsync(d => d.BusinessId == tempTech.Id);
                            unitofwork.Complete();

                        }

                        //清洗数据
                        DelData(tempWorkList, tempLoadList, tempMakeList, tempVideoList, tempTech.Id);
                        //foreach (var item in tempWorkList)
                        //{
                        //    await _rTableBaseEntity.HardDeleteAsync(item);
                        //}
                        //foreach (var item in tempLoadList)
                        //{
                        //    await _loadPieceRepository.HardDeleteAsync(item);
                        //}
                        //foreach (var item in tempMakeList)
                        //{
                        //    await _makeResourcesEntityRepository.HardDeleteAsync(item);
                        //}
                        //foreach (var item in tempVideoList)
                        //{
                        //    await _videoEntityRepository.HardDeleteAsync(item);
                        //}

                    }

                    using (var unitofwork = _unitOfWorkManager.Begin(System.Transactions.TransactionScopeOption.RequiresNew))
                    {
                        try
                        {
                            var jsonStr = ReadJson.GetFileJson(tempTask.FilePath);
                            var ReturnBopTaskOutDto = JsonConvert.DeserializeObject<ReturnBopTaskOutDto>(jsonStr);
                            var techniqueList = ObjectMapper.Map<RTechniqueEntity>(ReturnBopTaskOutDto.TechniqueTask);
                            techniqueList.Id = Guid.NewGuid();
                            techniqueList.TechniqueEntityId = ReturnBopTaskOutDto.TechniqueTask.Id;
                            techniqueList.LotNo = ReturnBopTaskOutDto.LotNo;
                            techniqueList.Model = ReturnBopTaskOutDto.Model;
                            techniqueList.ProcessesEntities = new List<RProcessesEntity>();
                            //工艺文件，工序，工步， 表
                            var techniqueReturnId = await InsertAll(ReturnBopTaskOutDto.TechniqueTask, techniqueList);
                            //接口传
                            _ibopNodeAppService.UpdateReturnStatus(ReturnBopTaskOutDto.TechniqueTask.BopNodeId, techniqueList.Id);
                            Common.TableMapConfig tableMapConfig = new Common.TableMapConfig();
                            Dictionary<string, FiledNodeMap> filedMap = tableMapConfig.InitFiledNodeMap();

                            var nodeDescId = _bopNodeRepository.GetAll().FirstOrDefault(d => d.TechniqueEntityId == techniqueList.TechniqueEntityId).BopDescId;
                            var bopDesc = _bopDescRepository.FirstOrDefault(d => d.Id == nodeDescId);
                            //获取所有用户
                            var userList = _userRepository.GetAll();
                            User user;
                            if (ReturnBopTaskOutDto._editFileList != null)
                            {
                                foreach (var item in ReturnBopTaskOutDto._editFileList)
                                {
                                    deleteEditFile(item.FileProcessSpecificationId);
                                    //这样传入返回新的Techid 就可以查出所有信息
                                    item.RTechniqueEntityId = techniqueReturnId;
                                    //根据用户名获取用户Id
                                    user = userList.FirstOrDefault(s => s.UserName == item.CreatorUserName);
                                    item.CreatorUserId = user?.Id;
                                    item.Id = Guid.NewGuid();
                                    _editFileProcessRepository.Insert(item);
                                    OperationLog tempLog = new OperationLog();
                                    tempLog.BusinessId = techniqueList.TechniqueEntityId;
                                    tempLog.BusinessType = BusinessTypes.Bop质量变更记录;
                                    tempLog.OperationType = OperationTypes.默认修改;
                                    tempLog.Content = DateTime.Now.ToShortDateString() + "回传版本" + item._editVersion;
                                    tempLog.CreatorUserId = user?.Id;
                                    _operationHistoryRepository.Insert(tempLog);
                                    var pphr = item._editFileList.OrderBy(d => d.CreationTime).ToList();

                                    for (int j = 0; j < pphr.Count; j++)
                                    {
                                        string techName = "";
                                        var currentPro = ReturnBopTaskOutDto.TechniqueTask.ProcessesListDto.Where(d => d.Id == item._editFileList[j].ProcessId).FirstOrDefault();
                                        WorkStepReturnDto currentWork = new WorkStepReturnDto();
                                        if (currentPro != null)
                                        {
                                            currentWork = currentPro.WorkStepListDto.Where(d => d.Id == item._editFileList[j].StepId).FirstOrDefault();
                                        }
                                        TableNameDictionary dic = new TableNameDictionary();

                                        string tableFieldName = "";
                                        string fieldname = "";
                                        string ProName = "";
                                        string WorkName = "";
                                        if (currentPro != null)
                                        {
                                            ProName = "工序" + currentPro.ProcessesSequence.ToString();
                                        }
                                        if (currentWork != null)
                                        {
                                            WorkName = "工步" + currentWork.WorkStepNumber.ToString();
                                        }
                                        foreach (KeyValuePair<string, FiledNodeMap> kvp in filedMap)
                                        {
                                            string tempStr = item._editFileList[j].TableFieldName;
                                            if (!string.IsNullOrEmpty(tempStr))
                                            {
                                                if (kvp.Value.filedNodeDto.ToLower() == tempStr.ToLower())
                                                {
                                                    tableFieldName = kvp.Key;
                                                    int index = kvp.Value.filedValue.IndexOf(char.ToLower(tempStr[0]) + tempStr.Substring(1));
                                                    if (index != -1)
                                                    {
                                                        fieldname = kvp.Value.filedKey[index];
                                                    }
                                                }
                                            }
                                        }
                                        OperationLog operationLog = new OperationLog();
                                        operationLog.BusinessId = techniqueList.Id;
                                        operationLog.BusinessType = BusinessTypes.Bop质量变更记录;
                                        if (item._editFileList[j].CreatorUserName != null)
                                        {
                                            string userName = "";
                                            user = userList.FirstOrDefault(s => s.UserName == item._editFileList[j].CreatorUserName);
                                            if (user != null)
                                            {
                                                userName = user.Surname + user.Name;
                                                operationLog.UserName = userName;
                                                operationLog.UserId = user.Id;
                                            }

                                        }
                                        switch (item._editFileList[j].Type)
                                        {
                                            case 0:
                                                operationLog.OperationType = OperationTypes.编辑表格内容;
                                                operationLog.Content = ProName + "-" + WorkName + tableFieldName + "编辑表格内容" + fieldname + ",原数据为:" + item._editFileList[j].OldValue + "修改为：" + item._editFileList[j].NewValue;
                                                break;
                                            case 1:
                                                operationLog.OperationType = OperationTypes.批量编辑表格内容;
                                                operationLog.Content = ProName + "-" + WorkName + tableFieldName + "批量编辑表格内容" + fieldname + ",原数据为:" + item._editFileList[j].OldValue + "修改为：" + item._editFileList[j].NewValue;
                                                break;
                                            case 2:
                                                operationLog.OperationType = OperationTypes.表格添加行;
                                                operationLog.Content = ProName + "-" + WorkName + tableFieldName + "表格添加行" + fieldname + ",添加数据为:" + item._editFileList[j].NewValue;
                                                break;
                                            case 3:
                                                operationLog.OperationType = OperationTypes.添加表;
                                                operationLog.Content = ProName + "-" + WorkName + ",添加表:" + tableFieldName;
                                                break;
                                            case 4:
                                                operationLog.OperationType = OperationTypes.编辑工步描述;
                                                operationLog.Content = ProName + "编辑工步描述" + WorkName + ",原工步描述:" + item._editFileList[j].OldValue + "修改为：" + item._editFileList[j].NewValue;
                                                break;
                                            case 5:
                                                operationLog.OperationType = OperationTypes.新增工步;
                                                operationLog.Content = ProName + "新增工步" + WorkName;
                                                break;
                                            case 6:
                                                operationLog.OperationType = OperationTypes.表格删除行;
                                                operationLog.Content = ProName + "-" + WorkName + tableFieldName + "表格删除行" + fieldname + ",删除数据为:" + item._editFileList[j].NewValue;
                                                break;
                                            case 7:
                                                operationLog.OperationType = OperationTypes.删除表;
                                                operationLog.Content = ProName + "-" + WorkName + ",删除表:" + tableFieldName;
                                                break;
                                            case 8:
                                                operationLog.OperationType = OperationTypes.删除工步;
                                                operationLog.Content = ProName + "删除工步" + WorkName;
                                                break;
                                            case 9:
                                                operationLog.OperationType = OperationTypes.编辑状态下编辑表格内容;
                                                operationLog.Content = "编辑状态下编辑表格内容:" + fieldname + ",原数据为:" + item._editFileList[j].OldValue + "修改为：" + item._editFileList[j].NewValue;
                                                break;
                                            case 10:
                                                operationLog.OperationType = OperationTypes.编辑状态下批量编辑表格内容;
                                                operationLog.Content = "编辑状态下批量编辑表格内容:" + fieldname + ",原数据为:" + item._editFileList[j].OldValue + "修改为：" + item._editFileList[j].NewValue;
                                                break;
                                            case 11:
                                                operationLog.OperationType = OperationTypes.编辑现场异常记录;
                                                operationLog.Content = ProName + "-" + WorkName + tableFieldName + "编辑现场异常记录";
                                                break;
                                            case 12:
                                                operationLog.OperationType = OperationTypes.打开文件;
                                                operationLog.Content = "打开文件";
                                                break;
                                            case 13:
                                                operationLog.OperationType = OperationTypes.锁定行;
                                                operationLog.Content = ProName + "-" + WorkName + item._editFileList[j].TableFieldName + "锁定行";
                                                break;
                                            case 14:
                                                operationLog.OperationType = OperationTypes.解除锁定行;
                                                operationLog.Content = ProName + "-" + WorkName + item._editFileList[j].TableFieldName + "解除锁定行";
                                                break;
                                            case 15:
                                                operationLog.OperationType = OperationTypes.锁定工步;
                                                operationLog.Content = ProName + "锁定工步" + WorkName;
                                                break;
                                            case 16:
                                                operationLog.OperationType = OperationTypes.解除锁定工步;
                                                operationLog.Content = ProName + "解除锁定工步" + WorkName;
                                                break;
                                            case 17:
                                                operationLog.OperationType = OperationTypes.取消三检;
                                                operationLog.Content = ProName + "-" + WorkName + item._editFileList[j].TableFieldName + "取消三检";
                                                break;
                                            case 18:
                                                operationLog.OperationType = OperationTypes.升版;
                                                operationLog.Content = ReturnBopTaskOutDto.TechniqueTask.TechniqueNumber + "升版";
                                                break;
                                            default:
                                                operationLog.OperationType = OperationTypes.默认修改;
                                                operationLog.Content = ProName + "默认修改";
                                                break;
                                        }
                                        _operationHistoryRepository.Insert(operationLog);
                                    }
                                }
                            }
                            if (ReturnBopTaskOutDto.ClearSignatureRecord != null)
                            {
                                foreach (var item in ReturnBopTaskOutDto.ClearSignatureRecord)
                                {
                                    var guida = item.FileId;
                                    deleteClearSignatureRecord(guida);
                                    item.RTechniqueEntityId = techniqueReturnId;
                                    item.CreatorUserId = userList.FirstOrDefault(s => s.UserName == item.CreatorUserName)?.Id;

                                    _clearSignatureRecordRepository.Insert(item);
                                }
                            }

                            if (ReturnBopTaskOutDto.fileProcessOperationLogs != null)
                            {
                                ReturnBopTaskOutDto.fileProcessOperationLogs = ReturnBopTaskOutDto.fileProcessOperationLogs.OrderBy(d => d.creationTime).ToList();
                                for (int j = 0; j < ReturnBopTaskOutDto.fileProcessOperationLogs.Count; j++)
                                {
                                    var currentPro = ReturnBopTaskOutDto.TechniqueTask.ProcessesListDto.Where(d => d.Id == ReturnBopTaskOutDto.fileProcessOperationLogs[j].processId).FirstOrDefault();
                                    WorkStepReturnDto currentWork = new WorkStepReturnDto();
                                    if (currentPro != null)
                                    {
                                        currentWork = currentPro.WorkStepListDto.Where(d => d.Id == ReturnBopTaskOutDto.fileProcessOperationLogs[j].stepId).FirstOrDefault();
                                    }
                                    TableNameDictionary dic = new TableNameDictionary();
                                    string tableFieldName = ReturnBopTaskOutDto.fileProcessOperationLogs[j].tableDisplayName;
                                    string fieldname = ReturnBopTaskOutDto.fileProcessOperationLogs[j].fieldDisplayName;
                                    string ProName = "";
                                    string WorkName = "";
                                    if (currentPro != null)
                                    {
                                        ProName = "工序" + currentPro.ProcessesSequence.ToString();
                                    }
                                    if (currentWork != null)
                                    {
                                        WorkName = "工步" + currentWork.WorkStepNumber.ToString();
                                    }
                                    //foreach (KeyValuePair<string, FiledNodeMap> kvp in filedMap)
                                    //{
                                    //    string tempStr = ReturnBopTaskOutDto.fileProcessOperationLogs[j].tableFieldName;
                                    //    if (!string.IsNullOrEmpty(tempStr))
                                    //    {
                                    //        if (kvp.Value.filedNodeDto.ToLower() == tempStr.ToLower())
                                    //        {
                                    //            tableFieldName = kvp.Key;
                                    //            int index = kvp.Value.filedValue.IndexOf(char.ToLower(tempStr[0]) + tempStr.Substring(1));
                                    //            if (index != -1)
                                    //            {
                                    //                fieldname = kvp.Value.filedKey[index];
                                    //            }
                                    //        }
                                    //    }
                                    //}
                                    OperationLog operationLog = new OperationLog();
                                    operationLog.BusinessId = techniqueList.Id;
                                    operationLog.BusinessType = BusinessTypes.Bop质量执行记录;
                                    if (ReturnBopTaskOutDto.fileProcessOperationLogs[j].creatorUserId != null)
                                    {
                                        string userName = "";
                                        user = userList.FirstOrDefault(d => d.UserName == ReturnBopTaskOutDto.fileProcessOperationLogs[j].CreatorUserName);
                                        if (user != null)
                                        {
                                            userName = user.Surname + user.Name;
                                            operationLog.UserName = userName;
                                            operationLog.UserId = user.Id;
                                        }

                                    }

                                    switch (ReturnBopTaskOutDto.fileProcessOperationLogs[j].type)
                                    {
                                        case 0:
                                            operationLog.OperationType = OperationTypes.编辑表格内容;
                                            operationLog.Content = ProName + "-" + WorkName + tableFieldName + "编辑表格内容" + fieldname + ",原数据为:" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].oldValue + "修改为：" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].newValue;
                                            break;
                                        case 1:
                                            operationLog.OperationType = OperationTypes.表格添加行;
                                            operationLog.Content = ProName + "-" + WorkName + tableFieldName + "表格添加行" + fieldname + ",添加数据为:" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].newValue;
                                            break;
                                        case 2:
                                            operationLog.OperationType = OperationTypes.添加表;
                                            operationLog.Content = ProName + "-" + WorkName + ",添加表:" + tableFieldName;
                                            break;
                                        case 3:
                                            operationLog.OperationType = OperationTypes.编辑工步描述;
                                            operationLog.Content = ProName + "编辑工步描述" + WorkName + ",原工步描述:" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].oldValue + "修改为：" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].newValue;
                                            break;
                                        case 4:
                                            operationLog.OperationType = OperationTypes.新增工步;
                                            operationLog.Content = ProName + "新增工步" + WorkName;
                                            break;
                                        case 5:
                                            operationLog.OperationType = OperationTypes.表格删除行;
                                            operationLog.Content = ProName + "-" + WorkName + tableFieldName + "表格删除行" + fieldname + ",删除数据为:" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].newValue;
                                            break;
                                        case 6:
                                            operationLog.OperationType = OperationTypes.删除表;
                                            operationLog.Content = ProName + "-" + WorkName + ",删除表:" + tableFieldName;
                                            break;
                                        case 7:
                                            operationLog.OperationType = OperationTypes.删除工步;
                                            operationLog.Content = ProName + "删除工步" + WorkName;
                                            break;
                                        case 8:
                                            operationLog.OperationType = OperationTypes.编辑状态下编辑表格内容;
                                            operationLog.Content = "编辑状态下编辑表格内容:" + fieldname + ",原数据为:" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].oldValue + "修改为：" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].newValue;
                                            break;
                                        case 9:
                                            operationLog.OperationType = OperationTypes.编辑状态下批量编辑表格内容;
                                            operationLog.Content = "编辑状态下批量编辑表格内容:" + fieldname + ",原数据为:" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].oldValue + "修改为：" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].newValue;
                                            break;
                                        case 10:
                                            operationLog.OperationType = OperationTypes.编辑现场异常记录;
                                            operationLog.Content = ProName + "-" + WorkName + tableFieldName + "编辑现场异常记录";
                                            break;
                                        case 11:
                                            operationLog.OperationType = OperationTypes.打开文件;
                                            operationLog.Content = "打开文件";
                                            break;
                                        case 12:
                                            operationLog.OperationType = OperationTypes.锁定行;
                                            operationLog.Content = ProName + "-" + WorkName + ReturnBopTaskOutDto.fileProcessOperationLogs[j].tableDisplayName + "锁定行";
                                            break;
                                        case 13:
                                            operationLog.OperationType = OperationTypes.解除锁定行;
                                            operationLog.Content = ProName + "-" + WorkName + ReturnBopTaskOutDto.fileProcessOperationLogs[j].tableDisplayName + "解除锁定行";
                                            break;
                                        case 14:
                                            operationLog.OperationType = OperationTypes.锁定工步;
                                            operationLog.Content = ProName + "锁定工步" + WorkName;
                                            break;
                                        case 15:
                                            operationLog.OperationType = OperationTypes.解除锁定工步;
                                            operationLog.Content = ProName + "解除锁定工步" + WorkName;
                                            break;
                                        case 16:
                                            operationLog.OperationType = OperationTypes.取消三检;
                                            operationLog.Content = ProName + "-" + WorkName + ReturnBopTaskOutDto.fileProcessOperationLogs[j].tableDisplayName + "取消三检";
                                            break;
                                        case 17:
                                            operationLog.OperationType = OperationTypes.升版;
                                            operationLog.Content = ReturnBopTaskOutDto.TechniqueTask.TechniqueNumber + "升版";
                                            break;
                                        default:
                                            operationLog.OperationType = OperationTypes.默认修改;
                                            operationLog.Content = ProName + "默认修改";
                                            break;
                                    }
                                    _operationHistoryRepository.Insert(operationLog);
                                }
                            }

                            if (ReturnBopTaskOutDto.FileException != null)
                            {
                                foreach (var item in ReturnBopTaskOutDto.FileException)
                                {
                                    //根据异常单号查询表里是否有重复数据
                                    var inspectionStandard = _inspectionStandardDescRepository.FirstOrDefault(s => s.Code == item.Number);
                                    //没有的时候新增
                                    if (inspectionStandard == null)
                                    {
                                        InspectionStandardDesc inspectionStandardDesc = new InspectionStandardDesc();
                                        inspectionStandardDesc.Id = Guid.NewGuid();
                                        inspectionStandardDesc.Code = item.Number;
                                        //inspectionStandardDesc.InspectionTypeDescId
                                        //inspectionStandardDesc.InspectionItemInfoId
                                        inspectionStandardDesc.InspectionDetails = item.Description;
                                        var severity = _inspectionSeverityDescRepository.FirstOrDefault(s => s.Code == item.Level);
                                        if (severity != null) inspectionStandardDesc.InspectionSeverityDescId = severity.Id;
                                        var type = _inspectionTypeDescRepository.FirstOrDefault(s => s.Code == item.ExecptionType); //先写死,等5G回传修正
                                        if (type != null) inspectionStandardDesc.InspectionTypeDescId = type.Id;
                                        var itemInfo = _inspectionItemInfoRepository.FirstOrDefault(s => s.Code == item.ExecptionType);//先写死,等5G回传修正
                                        if (itemInfo != null) inspectionStandardDesc.InspectionItemInfoId = itemInfo.Id;
                                        inspectionStandardDesc.CreationTime = item.CreationTime;
                                        user = userList.FirstOrDefault(s => s.UserName == item.CreatorUserName);
                                        inspectionStandardDesc.CreatorUserId = user?.Id;
                                        inspectionStandardDesc.FileId = item.FileId;
                                        inspectionStandardDesc.TechniqueNumber = ReturnBopTaskOutDto.TechniqueTask.TechniqueNumber;
                                        inspectionStandardDesc.TechniqueName = ReturnBopTaskOutDto.TechniqueTask.TechniqueName;
                                        inspectionStandardDesc.ProcessId = item.ProcessId;
                                        inspectionStandardDesc.StepId = item.StepId;
                                        var process = ReturnBopTaskOutDto.TechniqueTask.ProcessesListDto.FirstOrDefault(s => s.Id == inspectionStandardDesc.ProcessId);
                                        if (process != null)
                                        {
                                            inspectionStandardDesc.ProcessesCode = "工序" + process.ProcessesSequence.ToString();
                                            inspectionStandardDesc.ProcessesName = process.ProcessesName;
                                            var workStep = process.WorkStepListDto.FirstOrDefault(d => d.Id == inspectionStandardDesc.StepId);
                                            if (workStep != null)
                                            {
                                                inspectionStandardDesc.WorkStepCode = "工步" + workStep.WorkStepNumber.ToString();
                                            }
                                        }
                                        inspectionStandardDesc.IsReturn = 1;
                                        if (item.FileExceptionProcessingRecords != null)
                                        {
                                            var records = item.FileExceptionProcessingRecords.OrderBy(s => s.CreationTime).ToList();
                                            var count = records.Count();
                                            if (records.Count() > 0) inspectionStandardDesc.State = (States)Enum.Parse(typeof(States), records[count - 1].Status.ToString());
                                            else inspectionStandardDesc.State = States.未处理;
                                            for (int u = 0; u < count; u++)
                                            {
                                                user = userList.FirstOrDefault(s => s.UserName == records[u].CreatorUserName);
                                                var username = "";
                                                if (user != null) username = user.Surname + user.Name;
                                                switch (records[u].Status)
                                                {
                                                    case 0:
                                                        inspectionStandardDesc.CauseAnalysis = records[u].Remark;
                                                        _iOperationHistoryAppService.InsertOperationLogNew(inspectionStandardDesc.Id, BusinessTypes.异常管理, OperationTypes.发起异常, username + "在" + records[u].CreationTime + "发起异常");
                                                        break;
                                                    case 1:
                                                        inspectionStandardDesc.TreatmentMeasures = records[u].Remark;
                                                        inspectionStandardDesc.HandlerId = records[u].CreatorUserId;
                                                        _iOperationHistoryAppService.InsertOperationLogNew(inspectionStandardDesc.Id, BusinessTypes.异常管理, OperationTypes.处理异常, username + "在" + records[u].CreationTime + "开始处理");
                                                        break;
                                                    case 2:
                                                        inspectionStandardDesc.ConfirmSuggest = records[u].Remark;
                                                        _iOperationHistoryAppService.InsertOperationLogNew(inspectionStandardDesc.Id, BusinessTypes.异常管理, OperationTypes.驳回异常, username + "在" + records[u].CreationTime + "驳回异常");
                                                        break;
                                                    case 3:
                                                        inspectionStandardDesc.ConfirmSuggest = records[u].Remark;
                                                        inspectionStandardDesc.ConfirmerId = records[u].CreatorUserId;
                                                        inspectionStandardDesc.ConfirmTime = records[u].CreationTime;
                                                        inspectionStandardDesc.CostTime = (records[u].CreationTime - item.CreationTime).TotalHours.ToString();
                                                        _iOperationHistoryAppService.InsertOperationLogNew(inspectionStandardDesc.Id, BusinessTypes.异常管理, OperationTypes.完成, username + "在" + records[u].CreationTime + "完成处理");
                                                        break;
                                                }
                                            }
                                        }
                                        await _inspectionStandardDescRepository.InsertAsync(inspectionStandardDesc);
                                        //图片处理
                                        if (!string.IsNullOrEmpty(item.MediaFiles))
                                        {
                                            var picture = item.MediaFiles.Split(',');
                                            for (int u = 0; u < picture.Count(); u++)
                                            {
                                                UploadPicture uploadPicture = new UploadPicture()
                                                {
                                                    Id = Guid.NewGuid(),
                                                    BusinessId = inspectionStandardDesc.Id,
                                                    Organization = (Inspection.Organizations)1,
                                                    Group = (Groups)1,
                                                    FileName = picture[u],
                                                };
                                                await _uploadPictureRepository.InsertAsync(uploadPicture);
                                            }
                                        }
                                    }
                                    //有重复数据时更新
                                    else
                                    {
                                        inspectionStandard.InspectionDetails = item.Description;
                                        inspectionStandard.InspectionDetails = item.Description;
                                        var severity = _inspectionSeverityDescRepository.FirstOrDefault(s => s.Code == item.Level);
                                        if (severity != null) inspectionStandard.InspectionSeverityDescId = severity.Id;
                                        var type = _inspectionTypeDescRepository.FirstOrDefault(s => s.Code == item.ExecptionType); //先写死,等5G回传修正
                                        if (type != null) inspectionStandard.InspectionTypeDescId = type.Id;
                                        var itemInfo = _inspectionItemInfoRepository.FirstOrDefault(s => s.Code == item.ExecptionType);//先写死,等5G回传修正
                                        if (itemInfo != null) inspectionStandard.InspectionItemInfoId = itemInfo.Id;
                                        inspectionStandard.FileId = item.FileId;
                                        inspectionStandard.ProcessId = item.ProcessId;
                                        inspectionStandard.StepId = item.StepId;
                                        user = userList.FirstOrDefault(s => s.UserName == item.LastModificationUserName);
                                        inspectionStandard.LastModifierUserId = user?.Id;
                                        inspectionStandard.LastModificationTime = item.LastModificationTime;
                                        var process = ReturnBopTaskOutDto.TechniqueTask.ProcessesListDto.FirstOrDefault(s => s.Id == inspectionStandard.ProcessId);
                                        if (process != null)
                                        {
                                            inspectionStandard.ProcessesCode = "工序" + process.ProcessesSequence.ToString();
                                            inspectionStandard.ProcessesName = process.ProcessesName;
                                            var workStep = process.WorkStepListDto.FirstOrDefault(d => d.Id == inspectionStandard.StepId);
                                            if (workStep != null)
                                            {
                                                inspectionStandard.WorkStepCode = "工步" + workStep.WorkStepNumber.ToString();
                                            }
                                        }
                                        if (item.FileExceptionProcessingRecords != null)
                                        {
                                            var records = item.FileExceptionProcessingRecords.OrderBy(s => s.CreationTime).ToList();
                                            var count = records.Count();
                                            if (records.Count() > 0) inspectionStandard.State = (States)Enum.Parse(typeof(States), records[count - 1].Status.ToString());
                                            else inspectionStandard.State = States.未处理;
                                            await _operationLogRepository.DeleteAsync(inspectionStandard.Id);
                                            // _unitOfWorkManager.Current.SaveChanges();
                                            for (int u = 0; u < count; u++)
                                            {
                                                user = userList.FirstOrDefault(s => s.UserName == records[u].CreatorUserName);
                                                var username = "";
                                                if (user != null) username = user.Surname + user.Name;
                                                switch (records[u].Status)
                                                {
                                                    case 0:
                                                        inspectionStandard.CauseAnalysis = records[u].Remark;
                                                        _iOperationHistoryAppService.InsertOperationLogNew(inspectionStandard.Id, BusinessTypes.异常管理, OperationTypes.发起异常, user + "在" + records[u].CreationTime + "发起异常");
                                                        break;
                                                    case 1:
                                                        inspectionStandard.TreatmentMeasures = records[u].Remark;
                                                        inspectionStandard.HandlerId = records[u].CreatorUserId;
                                                        _iOperationHistoryAppService.InsertOperationLogNew(inspectionStandard.Id, BusinessTypes.异常管理, OperationTypes.处理异常, user + "在" + records[u].CreationTime + "开始处理");
                                                        break;
                                                    case 2:
                                                        inspectionStandard.ConfirmSuggest = records[u].Remark;
                                                        _iOperationHistoryAppService.InsertOperationLogNew(inspectionStandard.Id, BusinessTypes.异常管理, OperationTypes.驳回异常, user + "在" + records[u].CreationTime + "驳回异常");
                                                        break;
                                                    case 3:
                                                        inspectionStandard.ConfirmSuggest = records[u].Remark;
                                                        inspectionStandard.ConfirmerId = records[u].CreatorUserId;
                                                        inspectionStandard.ConfirmTime = records[u].CreationTime;
                                                        inspectionStandard.CostTime = (records[u].CreationTime - item.CreationTime).TotalHours.ToString();
                                                        _iOperationHistoryAppService.InsertOperationLogNew(inspectionStandard.Id, BusinessTypes.异常管理, OperationTypes.完成, user + "在" + records[u].CreationTime + "完成处理");
                                                        break;
                                                }
                                            }
                                        }
                                        await _inspectionStandardDescRepository.UpdateAsync(inspectionStandard);
                                        //图片处理，删除旧的图片信息，重新增加
                                        await _uploadPictureRepository.DeleteAsync(s => s.BusinessId == inspectionStandard.Id);
                                        //_unitOfWorkManager.Current.SaveChanges();
                                        if (!string.IsNullOrEmpty(item.MediaFiles))
                                        {
                                            var picture = item.MediaFiles.Split(',');
                                            for (int u = 0; u < picture.Count(); u++)
                                            {
                                                UploadPicture uploadPicture = new UploadPicture()
                                                {
                                                    Id = Guid.NewGuid(),
                                                    BusinessId = inspectionStandard.Id,
                                                    Organization = (Inspection.Organizations)1,
                                                    Group = (Groups)1,
                                                    FileName = picture[u],
                                                };
                                                await _uploadPictureRepository.InsertAsync(uploadPicture);
                                            }
                                        }
                                    }
                                }
                            }

                            List<ProductionScheduler> addSchel = new List<ProductionScheduler>();

                            if (ReturnBopTaskOutDto.RosterPlans != null)
                            {
                                var workIdList = ReturnBopTaskOutDto.RosterPlans.Where(d => d.StepId != null).ToList();

                                var proIdList = ReturnBopTaskOutDto.RosterPlans.Where(d => d.StepId == null && d.ProcessId != null).ToList();
                                var schelderList = ReturnBopTaskOutDto.RosterPlans.Where(d => d.ProcessId == null).ToList();
                                if (schelderList.Count() > 0)
                                {
                                    List<Guid> nodeIds = new List<Guid>();
                                    nodeIds.AddRange(schelderList.Select(d => d.NodeId));
                                    var schelders = _productionSchedulerRepository.GetAll().Where(d => nodeIds.FindIndex(x => x == d.NodeId) != -1).ToList();
                                    if (schelders.Count > 0)
                                    {
                                        foreach (var item in schelders)
                                        {
                                            var tempSchelder = schelderList.Find(d => d.NodeId == item.NodeId);
                                            item.AssemblyStartTime = tempSchelder.StartTime;
                                            item.AssemblyEndTime = tempSchelder.EndTime;
                                            item.OrganizationUnitId = tempSchelder.OrganizationUnitId;
                                            item.OrganizationUnitDesc = tempSchelder.OrganizationUnitDesc;
                                            item.ProductingStatus = (ProductingStatus.生产中);     //tempSchelder.ProductingStatus;
                                            item.UserId = tempSchelder.UserId;
                                            item.WorkingHour = tempSchelder.WorkHour;
                                            item.PerformanceHour = tempSchelder.WorkHour;
                                            await _productionSchedulerRepository.UpdateAsync(item);
                                        }
                                        var schderIds = schelders.Select(d => d.NodeId).ToList();
                                        var insertSchders = schelderList.Where(d => schderIds.FindIndex(x => x == d.NodeId) == -1).ToList();
                                        foreach (var item in insertSchders)
                                        {
                                            ProductionScheduler productionScheduler = new ProductionScheduler();
                                            productionScheduler.Id = Guid.NewGuid();
                                            var nodeTemp = _bopNodeRepository.Get(item.NodeId);
                                            productionScheduler.ParentId = nodeTemp.Id;
                                            productionScheduler.NodeId = item.NodeId;
                                            productionScheduler.TechniqueName = techniqueList.TechniqueName;
                                            productionScheduler.TechniqueNumber = techniqueList.TechniqueNumber;
                                            productionScheduler.Model = bopDesc.Model;
                                            productionScheduler.LotNo = bopDesc.LotNo;
                                            productionScheduler.ModelId = bopDesc.ModelId;
                                            productionScheduler.LotNoId = bopDesc.LotNoId;
                                            productionScheduler.WorkingHour = item.WorkHour;
                                            productionScheduler.PerformanceHour = item.WorkHour;
                                            productionScheduler.ProductingStatus = (ProductingStatus.生产中);
                                            productionScheduler.ArrangementTime = DateTime.Now;
                                            productionScheduler.DispatcherId = GetCurrentUser().Id;
                                            productionScheduler.DispatcherName = GetCurrentUser().Surname + GetCurrentUser().Name;
                                            await _productionSchedulerRepository.InsertAsync(productionScheduler);
                                            addSchel.Add(productionScheduler);
                                        }
                                    }
                                    else
                                    {
                                        foreach (var item in schelderList)
                                        {
                                            ProductionScheduler productionScheduler = new ProductionScheduler();
                                            productionScheduler.Id = Guid.NewGuid();
                                            var nodeTemp = _bopNodeRepository.Get(item.NodeId);
                                            productionScheduler.ParentId = nodeTemp.Id;
                                            productionScheduler.NodeId = item.NodeId;
                                            productionScheduler.TechniqueName = techniqueList.TechniqueName;
                                            productionScheduler.TechniqueNumber = techniqueList.TechniqueNumber;
                                            productionScheduler.Model = bopDesc.Model;
                                            productionScheduler.LotNo = bopDesc.LotNo;
                                            productionScheduler.ModelId = bopDesc.ModelId;
                                            productionScheduler.LotNoId = bopDesc.LotNoId;
                                            productionScheduler.WorkingHour = item.WorkHour;
                                            productionScheduler.PerformanceHour = item.WorkHour;//默认绩效工时等于工时
                                            productionScheduler.ProductingStatus = ProductingStatus.生产中;
                                            productionScheduler.ArrangementTime = DateTime.Now;
                                            productionScheduler.DispatcherId = GetCurrentUser().Id;
                                            productionScheduler.DispatcherName = GetCurrentUser().Surname + GetCurrentUser().Name;
                                            await _productionSchedulerRepository.InsertAsync(productionScheduler);
                                            addSchel.Add(productionScheduler);
                                        }
                                    }
                                }
                                if (workIdList.Count > 0)
                                {
                                    List<Guid?> nodeIds = new List<Guid?>();
                                    nodeIds = workIdList.Select(d => d.StepId).ToList();
                                    var schelders = _productionSchedulerRepository.GetAll().Where(d => nodeIds.FindIndex(x => x == d.NodeId) != -1).ToList();
                                    if (schelders.Count > 0)
                                    {
                                        foreach (var item in schelders)
                                        {
                                            var tempSchelder = workIdList.Find(d => d.StepId == item.NodeId);
                                            item.AssemblyStartTime = tempSchelder.StartTime;
                                            item.AssemblyEndTime = tempSchelder.EndTime;
                                            item.OrganizationUnitId = tempSchelder.OrganizationUnitId;
                                            item.OrganizationUnitDesc = tempSchelder.OrganizationUnitDesc;
                                            item.ProductingStatus = (ProductingStatus.生产中);     //tempSchelder.ProductingStatus;
                                            item.UserId = tempSchelder.UserId;
                                            item.WorkingHour = tempSchelder.WorkHour;
                                            item.PerformanceHour = tempSchelder.WorkHour;
                                            await _productionSchedulerRepository.UpdateAsync(item);
                                        }
                                        var schderIds = schelders.Select(d => d.NodeId).ToList();
                                        var insertSchders = workIdList.Where(d => schderIds.FindIndex(x => x == d.StepId) == -1).ToList();
                                        foreach (var item in insertSchders)
                                        {
                                            var process = _processesRepository.Get(item.ProcessId.Value);
                                            ProductionScheduler productionScheduler = new ProductionScheduler();
                                            productionScheduler.Id = Guid.NewGuid();

                                            productionScheduler.ParentId = item.ProcessId.Value;
                                            productionScheduler.NodeId = item.StepId.Value;
                                            var workTemp = _workStepEntityRepository.Get(item.StepId.Value);
                                            productionScheduler.WorkStepDrawingNo = "工步" + process.ProcessesSequence + "-" + workTemp.WorkStepNumber.ToString();
                                            productionScheduler.WorkStepName = workTemp.WorkStepName;
                                            productionScheduler.DrawingNo = "工序" + process.ProcessesSequence;
                                            productionScheduler.ProductionName = process.ProcessesName;

                                            productionScheduler.TechniqueName = techniqueList.TechniqueName;
                                            productionScheduler.TechniqueNumber = techniqueList.TechniqueNumber;
                                            productionScheduler.Model = bopDesc.Model;
                                            productionScheduler.LotNo = bopDesc.LotNo;
                                            productionScheduler.ModelId = bopDesc.ModelId;
                                            productionScheduler.LotNoId = bopDesc.LotNoId;
                                            productionScheduler.WorkingHour = item.WorkHour;
                                            productionScheduler.PerformanceHour = item.WorkHour;
                                            productionScheduler.ProductingStatus = (ProductingStatus.生产中);//item.ProductingStatus;
                                            productionScheduler.ArrangementTime = DateTime.Now;
                                            productionScheduler.DispatcherId = GetCurrentUser().Id;
                                            productionScheduler.DispatcherName = GetCurrentUser().Surname + GetCurrentUser().Name;
                                            await _productionSchedulerRepository.InsertAsync(productionScheduler);
                                            addSchel.Add(productionScheduler);
                                        }
                                    }
                                    else
                                    {
                                        foreach (var item in workIdList)
                                        {
                                            var process = _processesRepository.Get(item.ProcessId.Value);
                                            ProductionScheduler productionScheduler = new ProductionScheduler();
                                            productionScheduler.Id = Guid.NewGuid();

                                            productionScheduler.ParentId = item.ProcessId.Value;
                                            productionScheduler.NodeId = item.StepId.Value;
                                            var workTemp = _workStepEntityRepository.Get(item.StepId.Value);
                                            productionScheduler.WorkStepDrawingNo = "工步" + process.ProcessesSequence + "-" + workTemp.WorkStepNumber.ToString();
                                            productionScheduler.WorkStepName = workTemp.WorkStepName;
                                            productionScheduler.DrawingNo = "工序" + process.ProcessesSequence;
                                            productionScheduler.ProductionName = process.ProcessesName;

                                            productionScheduler.TechniqueName = techniqueList.TechniqueName;
                                            productionScheduler.TechniqueNumber = techniqueList.TechniqueNumber;
                                            productionScheduler.Model = bopDesc.Model;
                                            productionScheduler.LotNo = bopDesc.LotNo;
                                            productionScheduler.ModelId = bopDesc.ModelId;
                                            productionScheduler.LotNoId = bopDesc.LotNoId;
                                            productionScheduler.WorkingHour = item.WorkHour;
                                            productionScheduler.PerformanceHour = item.WorkHour;//默认绩效工时等于工时
                                            productionScheduler.ProductingStatus = ProductingStatus.生产中; //(ProductingStatus)item.ProductingStatus;
                                            productionScheduler.ArrangementTime = DateTime.Now;
                                            productionScheduler.DispatcherId = GetCurrentUser().Id;
                                            productionScheduler.DispatcherName = GetCurrentUser().Surname + GetCurrentUser().Name;
                                            await _productionSchedulerRepository.InsertAsync(productionScheduler);
                                            addSchel.Add(productionScheduler);
                                        }

                                    }
                                }
                                if (proIdList.Count > 0)
                                {
                                    List<Guid?> nodeIds = new List<Guid?>();
                                    nodeIds.AddRange(proIdList.Select(d => d.ProcessId));
                                    var schelders = _productionSchedulerRepository.GetAll().Where(d => nodeIds.FindIndex(x => x == d.NodeId) != -1).ToList();
                                    if (schelders.Count > 0)
                                    {
                                        foreach (var item in schelders)
                                        {
                                            var tempSchelder = proIdList.Find(d => d.ProcessId == item.NodeId);
                                            item.AssemblyStartTime = tempSchelder.StartTime;
                                            item.AssemblyEndTime = tempSchelder.EndTime;
                                            item.OrganizationUnitId = tempSchelder.OrganizationUnitId;
                                            item.OrganizationUnitDesc = tempSchelder.OrganizationUnitDesc;
                                            item.ProductingStatus = (ProductingStatus.生产中);     //tempSchelder.ProductingStatus;
                                            item.UserId = tempSchelder.UserId;
                                            item.WorkingHour = tempSchelder.WorkHour;
                                            item.PerformanceHour = tempSchelder.WorkHour;
                                            await _productionSchedulerRepository.UpdateAsync(item);
                                        }
                                        var schderIds = schelders.Select(d => d.NodeId).ToList();
                                        var insertSchders = proIdList.Where(d => schderIds.FindIndex(x => x == d.ProcessId) == -1).ToList();
                                        foreach (var item in insertSchders)
                                        {
                                            var process = _processesRepository.Get(item.ProcessId.Value);
                                            ProductionScheduler productionScheduler = new ProductionScheduler();
                                            productionScheduler.Id = Guid.NewGuid();

                                            productionScheduler.ParentId = ReturnBopTaskOutDto.TechniqueTask.Id;
                                            productionScheduler.NodeId = item.ProcessId.Value;
                                            productionScheduler.DrawingNo = "工序" + process.ProcessesSequence;
                                            productionScheduler.ProductionName = process.ProcessesName;

                                            productionScheduler.TechniqueName = techniqueList.TechniqueName;
                                            productionScheduler.TechniqueNumber = techniqueList.TechniqueNumber;
                                            productionScheduler.Model = bopDesc.Model;
                                            productionScheduler.LotNo = bopDesc.LotNo;
                                            productionScheduler.ModelId = bopDesc.ModelId;
                                            productionScheduler.LotNoId = bopDesc.LotNoId;
                                            productionScheduler.WorkingHour = item.WorkHour;
                                            productionScheduler.PerformanceHour = item.WorkHour;
                                            productionScheduler.ProductingStatus = (ProductingStatus.生产中);//item.ProductingStatus;
                                            productionScheduler.ArrangementTime = DateTime.Now;
                                            productionScheduler.DispatcherId = GetCurrentUser().Id;
                                            productionScheduler.DispatcherName = GetCurrentUser().Surname + GetCurrentUser().Name;
                                            await _productionSchedulerRepository.InsertAsync(productionScheduler);
                                            addSchel.Add(productionScheduler);
                                        }
                                    }
                                    else
                                    {
                                        foreach (var item in proIdList)
                                        {
                                            var process = _processesRepository.Get(item.ProcessId.Value);
                                            ProductionScheduler productionScheduler = new ProductionScheduler();
                                            productionScheduler.Id = Guid.NewGuid();

                                            productionScheduler.ParentId = ReturnBopTaskOutDto.TechniqueTask.Id;
                                            productionScheduler.NodeId = item.ProcessId.Value;
                                            productionScheduler.DrawingNo = "工序" + process.ProcessesSequence;
                                            productionScheduler.ProductionName = process.ProcessesName;

                                            productionScheduler.TechniqueName = techniqueList.TechniqueName;
                                            productionScheduler.TechniqueNumber = techniqueList.TechniqueNumber;
                                            productionScheduler.Model = bopDesc.Model;
                                            productionScheduler.LotNo = bopDesc.LotNo;
                                            productionScheduler.ModelId = bopDesc.ModelId;
                                            productionScheduler.LotNoId = bopDesc.LotNoId;
                                            productionScheduler.WorkingHour = item.WorkHour;
                                            productionScheduler.PerformanceHour = item.WorkHour;//默认绩效工时等于工时
                                            productionScheduler.ProductingStatus = ProductingStatus.生产中; //(ProductingStatus)item.ProductingStatus;
                                            productionScheduler.ArrangementTime = DateTime.Now;
                                            productionScheduler.DispatcherId = GetCurrentUser().Id;
                                            productionScheduler.DispatcherName = GetCurrentUser().Surname + GetCurrentUser().Name;
                                            await _productionSchedulerRepository.InsertAsync(productionScheduler);
                                            addSchel.Add(productionScheduler);
                                        }

                                    }
                                }

                            }

                            if (ReturnBopTaskOutDto.FileWorkingHours != null)
                            {
                                foreach (var item in ReturnBopTaskOutDto.FileWorkingHours)
                                {
                                    var process = _processesRepository.Get(item.ProcessId.Value);
                                    if (item.StepId != null)
                                    {
                                        var work = await _workStepEntityRepository.GetAsync(item.StepId.Value);
                                        var schelderTemp = _productionSchedulerRepository.GetAll().Where(d => d.NodeId == work.Id).FirstOrDefault();
                                        if (schelderTemp != null)
                                        {
                                            await _jobWorkerRepository.DeleteAsync(d => d.TaskId == schelderTemp.Id);
                                            var totalHour = item.FileWorkingHoursUserRecords.Sum(d => d.Hours);
                                            if (totalHour == work.WorkStepWorking && work.WorkStepWorking != 0)
                                            {
                                                schelderTemp.ProductingStatus = ProductingStatus.已完成;
                                                await _productionSchedulerRepository.UpdateAsync(schelderTemp);
                                            }
                                            foreach (var citem in item.FileWorkingHoursUserRecords)
                                            {
                                                JobWorker worker = new JobWorker();
                                                worker.TaskId = schelderTemp.Id;
                                                worker.UserId = citem.UserId;
                                                user = userList.FirstOrDefault(d => d.UserName == citem.CreatorUserName);
                                                if (user != null)
                                                {
                                                    worker.UserName = user.FullName;
                                                    worker.CreatorUserId = user.Id;
                                                }
                                                worker.PerformanceHour = 0;
                                                worker.ReportHour = citem.Hours;
                                                worker.ReportTime = citem.CreationTime;
                                                worker.PerformanceHour = work.WorkStepWorking;
                                                var userOr = await _userOrganizationUnitRepository.FirstOrDefaultAsync(d => d.UserId == citem.UserId);
                                                if (userOr != null)
                                                {
                                                    worker.OrganizationUnitId = userOr.OrganizationUnitId;
                                                    worker.OrganizationUnitDesc = _organizationUnitRepository.Get(worker.OrganizationUnitId).DisplayName;
                                                }
                                                await _jobWorkerRepository.InsertAsync(worker);
                                            }
                                        }
                                        else
                                        {
                                            ProductionScheduler productionScheduler = new ProductionScheduler();
                                            if (addSchel.FindIndex(d => d.NodeId == item.StepId) != -1)
                                            {
                                                productionScheduler = addSchel.Find(d => d.NodeId == item.StepId);
                                            }
                                            else
                                            {
                                                productionScheduler.Id = Guid.NewGuid();
                                                productionScheduler.ParentId = item.ProcessId.Value;
                                                productionScheduler.NodeId = item.StepId.Value;

                                                productionScheduler.WorkStepDrawingNo = "工步" + process.ProcessesSequence + "-" + work.WorkStepNumber.ToString();
                                                productionScheduler.WorkStepName = work.WorkStepName;
                                                productionScheduler.DrawingNo = "工序" + process.ProcessesSequence;
                                                productionScheduler.ProductionName = process.ProcessesName;
                                                productionScheduler.TechniqueName = techniqueList.TechniqueName;
                                                productionScheduler.TechniqueNumber = techniqueList.TechniqueNumber;
                                                productionScheduler.Model = bopDesc.Model;
                                                productionScheduler.LotNo = bopDesc.LotNo;
                                                productionScheduler.ModelId = bopDesc.ModelId;
                                                productionScheduler.LotNoId = bopDesc.LotNoId;
                                                productionScheduler.WorkingHour = work.WorkStepWorking;
                                                productionScheduler.PerformanceHour = work.WorkStepWorking;//默认绩效工时等于工时
                                                user = userList.FirstOrDefault(d => d.UserName == item.CreatorUserName);
                                                if (user != null)
                                                {
                                                    productionScheduler.CreatorUserId = user.Id;
                                                }

                                                var totalHour = item.FileWorkingHoursUserRecords.Sum(d => d.Hours);
                                                if (totalHour == work.WorkStepWorking && work.WorkStepWorking != 0)
                                                {
                                                    productionScheduler.ProductingStatus = ProductingStatus.已完成;

                                                }
                                                else
                                                {
                                                    productionScheduler.ProductingStatus = ProductingStatus.生产中;
                                                }

                                                productionScheduler.ArrangementTime = DateTime.Now;
                                                productionScheduler.DispatcherId = GetCurrentUser().Id;
                                                productionScheduler.DispatcherName = GetCurrentUser().Surname + GetCurrentUser().Name;
                                                await _productionSchedulerRepository.InsertAsync(productionScheduler);
                                            }



                                            foreach (var citem in item.FileWorkingHoursUserRecords)
                                            {
                                                JobWorker worker = new JobWorker();
                                                worker.TaskId = productionScheduler.Id;
                                                worker.UserId = citem.UserId;
                                                user = userList.FirstOrDefault(d => d.Id == citem.UserId);
                                                if (user != null)
                                                {
                                                    worker.UserName = user.FullName;
                                                }

                                                worker.PerformanceHour = 0;
                                                worker.ReportHour = citem.Hours;
                                                worker.ReportTime = citem.CreationTime;
                                                worker.PerformanceHour = work.WorkStepWorking;
                                                var creatorUser = userList.FirstOrDefault(s => s.UserName == citem.CreatorUserName);
                                                if (creatorUser != null)
                                                {
                                                    worker.CreatorUserId = creatorUser.Id;
                                                }
                                                var userOr = await _userOrganizationUnitRepository.FirstOrDefaultAsync(d => d.UserId == citem.UserId);
                                                if (userOr != null)
                                                {
                                                    worker.OrganizationUnitId = userOr.OrganizationUnitId;
                                                    worker.OrganizationUnitDesc = _organizationUnitRepository.Get(worker.OrganizationUnitId).DisplayName;
                                                }
                                                await _jobWorkerRepository.InsertAsync(worker);
                                            }
                                        }
                                    }
                                    else
                                    {
                                        var schelderTemp = _productionSchedulerRepository.GetAll().Where(d => d.NodeId == process.Id).FirstOrDefault();
                                        if (schelderTemp != null)
                                        {
                                            await _jobWorkerRepository.DeleteAsync(d => d.TaskId == schelderTemp.Id);
                                            var totalHour = item.FileWorkingHoursUserRecords.Sum(d => d.Hours);
                                            if (totalHour == process.ProcessesWorking && process.ProcessesWorking != 0)
                                            {
                                                schelderTemp.ProductingStatus = ProductingStatus.已完成;
                                                await _productionSchedulerRepository.UpdateAsync(schelderTemp);
                                            }
                                            foreach (var citem in item.FileWorkingHoursUserRecords)
                                            {
                                                JobWorker worker = new JobWorker();
                                                worker.TaskId = schelderTemp.Id;
                                                worker.UserId = citem.UserId;
                                                user = userList.FirstOrDefault(d => d.Id == citem.UserId);
                                                if (user != null)
                                                {
                                                    worker.UserName = user.FullName;
                                                }
                                                worker.PerformanceHour = 0;
                                                worker.ReportHour = citem.Hours;
                                                worker.ReportTime = citem.CreationTime;
                                                worker.PerformanceHour = process.ProcessesWorking;
                                                var creatorUser = userList.FirstOrDefault(s => s.UserName == citem.CreatorUserName);
                                                if (creatorUser != null)
                                                {
                                                    worker.CreatorUserId = creatorUser.Id;
                                                }
                                                var userOr = await _userOrganizationUnitRepository.FirstOrDefaultAsync(d => d.UserId == citem.UserId);
                                                if (userOr != null)
                                                {
                                                    worker.OrganizationUnitId = userOr.OrganizationUnitId;
                                                    worker.OrganizationUnitDesc = _organizationUnitRepository.Get(worker.OrganizationUnitId).DisplayName;
                                                }
                                                await _jobWorkerRepository.InsertAsync(worker);
                                            }
                                        }
                                        else
                                        {
                                            ProductionScheduler productionScheduler = new ProductionScheduler();
                                            if (addSchel.FindIndex(d => d.NodeId == item.ProcessId) != -1)
                                            {
                                                productionScheduler = addSchel.Find(d => d.NodeId == item.ProcessId);
                                            }
                                            else
                                            {
                                                productionScheduler.Id = Guid.NewGuid();
                                                productionScheduler.ParentId = ReturnBopTaskOutDto.TechniqueTask.Id;
                                                productionScheduler.NodeId = item.ProcessId.Value;
                                                productionScheduler.DrawingNo = "工序" + process.ProcessesSequence;
                                                productionScheduler.ProductionName = process.ProcessesName;
                                                productionScheduler.TechniqueName = techniqueList.TechniqueName;
                                                productionScheduler.TechniqueNumber = techniqueList.TechniqueNumber;
                                                productionScheduler.Model = bopDesc.Model;
                                                productionScheduler.LotNo = bopDesc.LotNo;
                                                productionScheduler.ModelId = bopDesc.ModelId;
                                                productionScheduler.LotNoId = bopDesc.LotNoId;
                                                productionScheduler.WorkingHour = process.ProcessesWorking;
                                                productionScheduler.PerformanceHour = process.ProcessesWorking;//默认绩效工时等于工时
                                                var totalHour = item.FileWorkingHoursUserRecords.Sum(d => d.Hours);
                                                if (totalHour == process.ProcessesWorking && process.ProcessesWorking != 0)
                                                {
                                                    productionScheduler.ProductingStatus = ProductingStatus.已完成;

                                                }
                                                else
                                                {
                                                    productionScheduler.ProductingStatus = ProductingStatus.生产中;
                                                }
                                                productionScheduler.ArrangementTime = DateTime.Now;
                                                productionScheduler.DispatcherId = GetCurrentUser().Id;
                                                productionScheduler.DispatcherName = GetCurrentUser().Surname + GetCurrentUser().Name;
                                                await _productionSchedulerRepository.InsertAsync(productionScheduler);
                                            }

                                            foreach (var citem in item.FileWorkingHoursUserRecords)
                                            {
                                                JobWorker worker = new JobWorker();
                                                worker.TaskId = productionScheduler.Id;
                                                worker.UserId = citem.UserId;
                                                user = userList.FirstOrDefault(d => d.Id == citem.UserId);
                                                if (user != null)
                                                {
                                                    worker.UserName = user.FullName;
                                                }
                                                worker.PerformanceHour = 0;
                                                worker.ReportHour = citem.Hours;
                                                worker.PerformanceHour = process.ProcessesWorking;
                                                worker.ReportTime = citem.CreationTime;
                                                var creatorUser = userList.FirstOrDefault(s => s.UserName == citem.CreatorUserName);
                                                if (creatorUser != null)
                                                {
                                                    worker.CreatorUserId = creatorUser.Id;
                                                }
                                                var userOr = await _userOrganizationUnitRepository.FirstOrDefaultAsync(d => d.UserId == citem.UserId);
                                                if (userOr != null)
                                                {
                                                    worker.OrganizationUnitId = userOr.OrganizationUnitId;
                                                    worker.OrganizationUnitDesc = _organizationUnitRepository.Get(worker.OrganizationUnitId).DisplayName;
                                                }
                                                await _jobWorkerRepository.InsertAsync(worker);
                                            }
                                        }
                                    }

                                }


                            }

                        }
                        catch (Exception ex)
                        {
                            ConfigHelper.CreateLogText(ex.ToString());
                            message = ex.Message;
                            return message;

                        }
                        unitofwork.Complete();
                    }

                }
                return message;
            }
            else
            {
                message = "传入数据有误！请检查无误后重新尝试！";
                return message;
            }
        }


        ///原来的方法
        //public async Task<string> BatchAnalyJson(BackTaskInput input)//BackTaskInput input
        //{
        //    string message = "";
        //    if (input.BackTask.Count > 0)
        //    {
        //        for (int i = 0; i < input.BackTask.Count; i++)
        //        {
        //            var tempTask = input.BackTask[i];
        //            var tempTech = await _rTechniqueEntityRepository.FirstOrDefaultAsync(c => c.TechniqueNumber == tempTask.TechniqueNum);
        //            if (tempTech != null)
        //            {
        //                await _rTechniqueEntityRepository.DeleteAsync(d => d.Id == tempTech.Id);
        //                await _RprocessesRepository.DeleteAsync(d => d.RTechniqueEntityId == tempTech.Id);
        //                var tempWorkList = (from temp1 in _RWorkStepRepository.GetAll().Where(d => d.RTechniqueEntityId == tempTech.Id)
        //                                    join temp2 in _rTableBaseEntity.GetAllIncluding(a => a.RecordRequirements, b => b.InspectionSignature, c => c.MeasuredResult, d => d.Environment, e => e.MultiMedia) on temp1.Id equals temp2.RWorkStepEntityId
        //                                    select temp2).ToList();
        //                var tempLoadList = (from temp1 in _RWorkStepRepository.GetAll().Where(d => d.RTechniqueEntityId == tempTech.Id)
        //                                    join temp2 in _loadPieceRepository.GetAll() on temp1.Id equals temp2.RWorkStepEntityId
        //                                    select temp2).ToList();
        //                var tempMakeList = (from temp1 in _RWorkStepRepository.GetAll().Where(d => d.RTechniqueEntityId == tempTech.Id)
        //                                    join temp2 in _makeResourcesEntityRepository.GetAll() on temp1.Id equals temp2.RWorkStepEntityId
        //                                    select temp2).ToList();
        //                var tempVideoList = (from temp1 in _RWorkStepRepository.GetAll().Where(d => d.RTechniqueEntityId == tempTech.Id)
        //                                     join temp2 in _videoEntityRepository.GetAll() on temp1.Id equals temp2.RWorkStepEntityId
        //                                     select temp2).ToList();

        //                await _RWorkStepRepository.DeleteAsync(d => d.RTechniqueEntityId == tempTech.Id);
        //                foreach (var item in tempWorkList)
        //                {
        //                    await _rTableBaseEntity.DeleteAsync(item);
        //                }
        //                foreach (var item in tempLoadList)
        //                {
        //                    await _loadPieceRepository.DeleteAsync(item);
        //                }
        //                foreach (var item in tempMakeList)
        //                {
        //                    await _makeResourcesEntityRepository.DeleteAsync(item);
        //                }
        //                foreach (var item in tempVideoList)
        //                {
        //                    await _videoEntityRepository.DeleteAsync(item);
        //                }
        //                await _operationHistoryRepository.DeleteAsync(d => d.BusinessId == tempTech.Id);
        //            }
        //            try
        //            {
        //                var jsonStr = ReadJson.GetFileJson(tempTask.FilePath);
        //                var ReturnBopTaskOutDto = JsonConvert.DeserializeObject<ReturnBopTaskOutDto>(jsonStr);
        //                var techniqueList = ObjectMapper.Map<RTechniqueEntity>(ReturnBopTaskOutDto.TechniqueTask);
        //                techniqueList.Id = Guid.NewGuid();
        //                techniqueList.TechniqueEntityId = ReturnBopTaskOutDto.TechniqueTask.Id;
        //                techniqueList.LotNo = ReturnBopTaskOutDto.LotNo;
        //                techniqueList.Model = ReturnBopTaskOutDto.Model;
        //                techniqueList.ProcessesEntities = new List<RProcessesEntity>();
        //                //工艺文件，工序，工步， 表
        //                var techniqueReturnId = await InsertAll(ReturnBopTaskOutDto.TechniqueTask, techniqueList);
        //                //接口传
        //                _ibopNodeAppService.UpdateReturnStatus(ReturnBopTaskOutDto.TechniqueTask.BopNodeId, techniqueList.Id);
        //                Common.TableMapConfig tableMapConfig = new Common.TableMapConfig();
        //                Dictionary<string, FiledNodeMap> filedMap = tableMapConfig.InitFiledNodeMap();

        //                var nodeDescId = _bopNodeRepository.GetAll().FirstOrDefault(d => d.TechniqueEntityId == techniqueList.TechniqueEntityId).BopDescId;
        //                var bopDesc = _bopDescRepository.FirstOrDefault(d => d.Id == nodeDescId);

        //                if (ReturnBopTaskOutDto._editFileList != null)
        //                {

        //                    foreach (var item in ReturnBopTaskOutDto._editFileList)
        //                    {
        //                        OperationLog tempLog = new OperationLog();
        //                        tempLog.BusinessId = techniqueList.TechniqueEntityId;
        //                        tempLog.BusinessType = BusinessTypes.Bop质量变更记录;
        //                        tempLog.OperationType = OperationTypes.默认修改;
        //                        tempLog.Content = DateTime.Now.ToShortDateString() + "回传版本" + item._editVersion;
        //                        _operationHistoryRepository.Insert(tempLog);
        //                        item._editFileList = item._editFileList.OrderBy(d => d.CreationTime).ToList();
        //                        for (int j = 0; j < item._editFileList.Count; j++)
        //                        {
        //                            string techName = "";
        //                            var currentPro = ReturnBopTaskOutDto.TechniqueTask.ProcessesListDto.Where(d => d.Id == item._editFileList[j].ProcessId).FirstOrDefault();
        //                            WorkStepReturnDto currentWork = new WorkStepReturnDto();
        //                            if (currentPro != null)
        //                            {
        //                                currentWork = currentPro.WorkStepListDto.Where(d => d.Id == item._editFileList[j].StepId).FirstOrDefault();
        //                            }
        //                            TableNameDictionary dic = new TableNameDictionary();

        //                            string tableFieldName = "";
        //                            string fieldname = "";
        //                            string ProName = "";
        //                            string WorkName = "";
        //                            if (currentPro != null)
        //                            {
        //                                ProName = "工序" + currentPro.ProcessesSequence.ToString();
        //                            }
        //                            if (currentWork != null)
        //                            {
        //                                WorkName = "工步" + currentWork.WorkStepNumber.ToString();
        //                            }
        //                            foreach (KeyValuePair<string, FiledNodeMap> kvp in filedMap)
        //                            {
        //                                string tempStr = item._editFileList[j].TableFieldName;
        //                                if (!string.IsNullOrEmpty(tempStr))
        //                                {
        //                                    if (kvp.Value.filedNodeDto.ToLower() == tempStr.ToLower())
        //                                    {
        //                                        tableFieldName = kvp.Key;
        //                                        int index = kvp.Value.filedValue.IndexOf(char.ToLower(tempStr[0]) + tempStr.Substring(1));
        //                                        if (index != -1)
        //                                        {
        //                                            fieldname = kvp.Value.filedKey[index];
        //                                        }
        //                                    }
        //                                }
        //                            }
        //                            OperationLog operationLog = new OperationLog();
        //                            operationLog.BusinessId = techniqueList.Id;
        //                            operationLog.BusinessType = BusinessTypes.Bop质量变更记录;
        //                            if (item._editFileList[j].CreatorUserId != null)
        //                            {
        //                                string userName = "";
        //                                var user = _userRepository.GetAll().FirstOrDefault(d => d.Id == item._editFileList[j].CreatorUserId.Value);
        //                                if (user != null)
        //                                {
        //                                    userName = user.Surname + user.Name;
        //                                    operationLog.UserName = userName;
        //                                }
        //                                operationLog.UserId = item._editFileList[j].CreatorUserId;
        //                            }
        //                            switch (item._editFileList[j].Type)
        //                            {
        //                                case 0:
        //                                    operationLog.OperationType = OperationTypes.编辑表格内容;
        //                                    operationLog.Content = ProName + "-" + WorkName + tableFieldName + "编辑表格内容" + fieldname + ",原数据为:" + item._editFileList[j].OldValue + "修改为：" + item._editFileList[j].NewValue;
        //                                    break;
        //                                case 1:
        //                                    operationLog.OperationType = OperationTypes.批量编辑表格内容;
        //                                    operationLog.Content = ProName + "-" + WorkName + tableFieldName + "批量编辑表格内容" + fieldname + ",原数据为:" + item._editFileList[j].OldValue + "修改为：" + item._editFileList[j].NewValue;
        //                                    break;
        //                                case 2:
        //                                    operationLog.OperationType = OperationTypes.表格添加行;
        //                                    operationLog.Content = ProName + "-" + WorkName + tableFieldName + "表格添加行" + fieldname + ",添加数据为:" + item._editFileList[j].NewValue;
        //                                    break;
        //                                case 3:
        //                                    operationLog.OperationType = OperationTypes.添加表;
        //                                    operationLog.Content = ProName + "-" + WorkName + ",添加表:" + tableFieldName;
        //                                    break;
        //                                case 4:
        //                                    operationLog.OperationType = OperationTypes.编辑工步描述;
        //                                    operationLog.Content = ProName + "编辑工步描述" + WorkName + ",原工步描述:" + item._editFileList[j].OldValue + "修改为：" + item._editFileList[j].NewValue;
        //                                    break;
        //                                case 5:
        //                                    operationLog.OperationType = OperationTypes.新增工步;
        //                                    operationLog.Content = ProName + "新增工步" + WorkName;
        //                                    break;
        //                                case 6:
        //                                    operationLog.OperationType = OperationTypes.表格删除行;
        //                                    operationLog.Content = ProName + "-" + WorkName + tableFieldName + "表格删除行" + fieldname + ",删除数据为:" + item._editFileList[j].NewValue;
        //                                    break;
        //                                case 7:
        //                                    operationLog.OperationType = OperationTypes.删除表;
        //                                    operationLog.Content = ProName + "-" + WorkName + ",删除表:" + tableFieldName;
        //                                    break;
        //                                case 8:
        //                                    operationLog.OperationType = OperationTypes.删除工步;
        //                                    operationLog.Content = ProName + "删除工步" + WorkName;
        //                                    break;
        //                                case 9:
        //                                    operationLog.OperationType = OperationTypes.编辑状态下编辑表格内容;
        //                                    operationLog.Content = "编辑状态下编辑表格内容:" + fieldname + ",原数据为:" + item._editFileList[j].OldValue + "修改为：" + item._editFileList[j].NewValue;
        //                                    break;
        //                                case 10:
        //                                    operationLog.OperationType = OperationTypes.编辑状态下批量编辑表格内容;
        //                                    operationLog.Content = "编辑状态下批量编辑表格内容:" + fieldname + ",原数据为:" + item._editFileList[j].OldValue + "修改为：" + item._editFileList[j].NewValue;
        //                                    break;
        //                                case 11:
        //                                    operationLog.OperationType = OperationTypes.编辑现场异常记录;
        //                                    operationLog.Content = ProName + "-" + WorkName + tableFieldName + "编辑现场异常记录";
        //                                    break;
        //                                case 12:
        //                                    operationLog.OperationType = OperationTypes.打开文件;
        //                                    operationLog.Content = "打开文件";
        //                                    break;
        //                                case 13:
        //                                    operationLog.OperationType = OperationTypes.锁定行;
        //                                    operationLog.Content = ProName + "-" + WorkName + item._editFileList[j].TableFieldName + "锁定行";
        //                                    break;
        //                                case 14:
        //                                    operationLog.OperationType = OperationTypes.解除锁定行;
        //                                    operationLog.Content = ProName + "-" + WorkName + item._editFileList[j].TableFieldName + "解除锁定行";
        //                                    break;
        //                                case 15:
        //                                    operationLog.OperationType = OperationTypes.锁定工步;
        //                                    operationLog.Content = ProName + "锁定工步" + WorkName;
        //                                    break;
        //                                case 16:
        //                                    operationLog.OperationType = OperationTypes.解除锁定工步;
        //                                    operationLog.Content = ProName + "解除锁定工步" + WorkName;
        //                                    break;
        //                                case 17:
        //                                    operationLog.OperationType = OperationTypes.取消三检;
        //                                    operationLog.Content = ProName + "-" + WorkName + item._editFileList[j].TableFieldName + "取消三检";
        //                                    break;
        //                                case 18:
        //                                    operationLog.OperationType = OperationTypes.升版;
        //                                    operationLog.Content = ReturnBopTaskOutDto.TechniqueTask.TechniqueNumber + "升版";
        //                                    break;
        //                                default:
        //                                    operationLog.OperationType = OperationTypes.默认修改;
        //                                    operationLog.Content = ProName + "默认修改";
        //                                    break;
        //                            }
        //                            _operationHistoryRepository.Insert(operationLog);
        //                        }
        //                    }
        //                }
        //                if (ReturnBopTaskOutDto.fileProcessOperationLogs != null)
        //                {
        //                    ReturnBopTaskOutDto.fileProcessOperationLogs = ReturnBopTaskOutDto.fileProcessOperationLogs.OrderBy(d => d.creationTime).ToList();
        //                    for (int j = 0; j < ReturnBopTaskOutDto.fileProcessOperationLogs.Count; j++)
        //                    {
        //                        var currentPro = ReturnBopTaskOutDto.TechniqueTask.ProcessesListDto.Where(d => d.Id == ReturnBopTaskOutDto.fileProcessOperationLogs[j].processId).FirstOrDefault();
        //                        WorkStepReturnDto currentWork = new WorkStepReturnDto();
        //                        if (currentPro != null)
        //                        {
        //                            currentWork = currentPro.WorkStepListDto.Where(d => d.Id == ReturnBopTaskOutDto.fileProcessOperationLogs[j].stepId).FirstOrDefault();
        //                        }
        //                        TableNameDictionary dic = new TableNameDictionary();
        //                        string tableFieldName = ReturnBopTaskOutDto.fileProcessOperationLogs[j].tableDisplayName;
        //                        string fieldname = ReturnBopTaskOutDto.fileProcessOperationLogs[j].fieldDisplayName;
        //                        string ProName = "";
        //                        string WorkName = "";
        //                        if (currentPro != null)
        //                        {
        //                            ProName = "工序" + currentPro.ProcessesSequence.ToString();
        //                        }
        //                        if (currentWork != null)
        //                        {
        //                            WorkName = "工步" + currentWork.WorkStepNumber.ToString();
        //                        }
        //                        //foreach (KeyValuePair<string, FiledNodeMap> kvp in filedMap)
        //                        //{
        //                        //    string tempStr = ReturnBopTaskOutDto.fileProcessOperationLogs[j].tableFieldName;
        //                        //    if (!string.IsNullOrEmpty(tempStr))
        //                        //    {
        //                        //        if (kvp.Value.filedNodeDto.ToLower() == tempStr.ToLower())
        //                        //        {
        //                        //            tableFieldName = kvp.Key;
        //                        //            int index = kvp.Value.filedValue.IndexOf(char.ToLower(tempStr[0]) + tempStr.Substring(1));
        //                        //            if (index != -1)
        //                        //            {
        //                        //                fieldname = kvp.Value.filedKey[index];
        //                        //            }
        //                        //        }
        //                        //    }
        //                        //}
        //                        OperationLog operationLog = new OperationLog();
        //                        operationLog.BusinessId = techniqueList.Id;
        //                        operationLog.BusinessType = BusinessTypes.Bop质量执行记录;
        //                        if (ReturnBopTaskOutDto.fileProcessOperationLogs[j].creatorUserId != null)
        //                        {
        //                            string userName = "";
        //                            var user = _userRepository.GetAll().FirstOrDefault(d => d.Id == ReturnBopTaskOutDto.fileProcessOperationLogs[j].creatorUserId.Value);
        //                            if (user != null)
        //                            {
        //                                userName = user.Surname + user.Name;
        //                                operationLog.UserName = userName;
        //                            }
        //                            operationLog.UserId = ReturnBopTaskOutDto.fileProcessOperationLogs[j].creatorUserId;
        //                        }

        //                        switch (ReturnBopTaskOutDto.fileProcessOperationLogs[j].type)
        //                        {
        //                            case 0:
        //                                operationLog.OperationType = OperationTypes.编辑表格内容;
        //                                operationLog.Content = ProName + "-" + WorkName + tableFieldName + "编辑表格内容" + fieldname + ",原数据为:" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].oldValue + "修改为：" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].newValue;
        //                                break;
        //                            case 1:
        //                                operationLog.OperationType = OperationTypes.表格添加行;
        //                                operationLog.Content = ProName + "-" + WorkName + tableFieldName + "表格添加行" + fieldname + ",添加数据为:" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].newValue;
        //                                break;
        //                            case 2:
        //                                operationLog.OperationType = OperationTypes.添加表;
        //                                operationLog.Content = ProName + "-" + WorkName + ",添加表:" + tableFieldName;
        //                                break;
        //                            case 3:
        //                                operationLog.OperationType = OperationTypes.编辑工步描述;
        //                                operationLog.Content = ProName + "编辑工步描述" + WorkName + ",原工步描述:" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].oldValue + "修改为：" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].newValue;
        //                                break;
        //                            case 4:
        //                                operationLog.OperationType = OperationTypes.新增工步;
        //                                operationLog.Content = ProName + "新增工步" + WorkName;
        //                                break;
        //                            case 5:
        //                                operationLog.OperationType = OperationTypes.表格删除行;
        //                                operationLog.Content = ProName + "-" + WorkName + tableFieldName + "表格删除行" + fieldname + ",删除数据为:" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].newValue;
        //                                break;
        //                            case 6:
        //                                operationLog.OperationType = OperationTypes.删除表;
        //                                operationLog.Content = ProName + "-" + WorkName + ",删除表:" + tableFieldName;
        //                                break;
        //                            case 7:
        //                                operationLog.OperationType = OperationTypes.删除工步;
        //                                operationLog.Content = ProName + "删除工步" + WorkName;
        //                                break;
        //                            case 8:
        //                                operationLog.OperationType = OperationTypes.编辑状态下编辑表格内容;
        //                                operationLog.Content = "编辑状态下编辑表格内容:" + fieldname + ",原数据为:" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].oldValue + "修改为：" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].newValue;
        //                                break;
        //                            case 9:
        //                                operationLog.OperationType = OperationTypes.编辑状态下批量编辑表格内容;
        //                                operationLog.Content = "编辑状态下批量编辑表格内容:" + fieldname + ",原数据为:" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].oldValue + "修改为：" + ReturnBopTaskOutDto.fileProcessOperationLogs[j].newValue;
        //                                break;
        //                            case 10:
        //                                operationLog.OperationType = OperationTypes.编辑现场异常记录;
        //                                operationLog.Content = ProName + "-" + WorkName + tableFieldName + "编辑现场异常记录";
        //                                break;
        //                            case 11:
        //                                operationLog.OperationType = OperationTypes.打开文件;
        //                                operationLog.Content = "打开文件";
        //                                break;
        //                            case 12:
        //                                operationLog.OperationType = OperationTypes.锁定行;
        //                                operationLog.Content = ProName + "-" + WorkName + ReturnBopTaskOutDto.fileProcessOperationLogs[j].tableDisplayName + "锁定行";
        //                                break;
        //                            case 13:
        //                                operationLog.OperationType = OperationTypes.解除锁定行;
        //                                operationLog.Content = ProName + "-" + WorkName + ReturnBopTaskOutDto.fileProcessOperationLogs[j].tableDisplayName + "解除锁定行";
        //                                break;
        //                            case 14:
        //                                operationLog.OperationType = OperationTypes.锁定工步;
        //                                operationLog.Content = ProName + "锁定工步" + WorkName;
        //                                break;
        //                            case 15:
        //                                operationLog.OperationType = OperationTypes.解除锁定工步;
        //                                operationLog.Content = ProName + "解除锁定工步" + WorkName;
        //                                break;
        //                            case 16:
        //                                operationLog.OperationType = OperationTypes.取消三检;
        //                                operationLog.Content = ProName + "-" + WorkName + ReturnBopTaskOutDto.fileProcessOperationLogs[j].tableDisplayName + "取消三检";
        //                                break;
        //                            case 17:
        //                                operationLog.OperationType = OperationTypes.升版;
        //                                operationLog.Content = ReturnBopTaskOutDto.TechniqueTask.TechniqueNumber + "升版";
        //                                break;
        //                            default:
        //                                operationLog.OperationType = OperationTypes.默认修改;
        //                                operationLog.Content = ProName + "默认修改";
        //                                break;
        //                        }
        //                        _operationHistoryRepository.Insert(operationLog);
        //                    }
        //                }
        //                if (ReturnBopTaskOutDto.FileException != null)
        //                {
        //                    foreach (var item in ReturnBopTaskOutDto.FileException)
        //                    {
        //                        //根据异常单号查询表里是否有重复数据
        //                        var inspectionStandard = _inspectionStandardDescRepository.FirstOrDefault(s => s.Code == item.Number);
        //                        var userTemp = _userRepository.GetAll().ToList();
        //                        //没有的时候新增
        //                        if (inspectionStandard == null)
        //                        {
        //                            InspectionStandardDesc inspectionStandardDesc = new InspectionStandardDesc();
        //                            inspectionStandardDesc.Id = Guid.NewGuid();
        //                            inspectionStandardDesc.Code = item.Number;
        //                            //inspectionStandardDesc.InspectionTypeDescId
        //                            //inspectionStandardDesc.InspectionItemInfoId
        //                            inspectionStandardDesc.InspectionDetails = item.Description;
        //                            var severity = _inspectionSeverityDescRepository.FirstOrDefault(s => s.Code == item.Level);
        //                            if (severity != null) inspectionStandardDesc.InspectionSeverityDescId = severity.Id;
        //                            var type = _inspectionSeverityDescRepository.FirstOrDefault(s => s.Code == item.ExecptionType); //先写死,等5G回传修正
        //                            if (type != null) inspectionStandardDesc.InspectionSeverityDescId = type.Id;
        //                            var itemInfo = _inspectionSeverityDescRepository.FirstOrDefault(s => s.Code == item.ExecptionType);//先写死,等5G回传修正
        //                            if (itemInfo != null) inspectionStandardDesc.InspectionSeverityDescId = itemInfo.Id;
        //                            inspectionStandardDesc.CreationTime = item.CreationTime;
        //                            inspectionStandardDesc.CreatorUserId = item.CreatorUserId;
        //                            inspectionStandardDesc.FileId = item.FileId;
        //                            inspectionStandardDesc.TechniqueNumber = ReturnBopTaskOutDto.TechniqueTask.TechniqueNumber;
        //                            inspectionStandardDesc.TechniqueName = ReturnBopTaskOutDto.TechniqueTask.TechniqueName;
        //                            inspectionStandardDesc.ProcessId = item.ProcessId;
        //                            inspectionStandardDesc.StepId = item.StepId;
        //                            var process = ReturnBopTaskOutDto.TechniqueTask.ProcessesListDto.FirstOrDefault(s => s.Id == inspectionStandardDesc.ProcessId);
        //                            if (process != null)
        //                            {
        //                                inspectionStandardDesc.ProcessesCode = "工序" + process.ProcessesSequence.ToString();
        //                                inspectionStandardDesc.ProcessesName = process.ProcessesName;
        //                                var workStep = process.WorkStepListDto.FirstOrDefault(d => d.Id == inspectionStandardDesc.StepId);
        //                                if (workStep != null)
        //                                {
        //                                    inspectionStandardDesc.WorkStepCode = "工步" + workStep.WorkStepNumber.ToString();
        //                                }
        //                            }
        //                            inspectionStandardDesc.IsReturn = 1;
        //                            if (item.FileExceptionProcessingRecords != null)
        //                            {
        //                                var records = item.FileExceptionProcessingRecords.OrderBy(s => s.CreationTime).ToList();
        //                                var count = records.Count();
        //                                if (records.Count() > 0) inspectionStandardDesc.State = (States)Enum.Parse(typeof(States), records[count - 1].Status.ToString());
        //                                else inspectionStandardDesc.State = States.未处理;
        //                                for (int u = 0; u < count; u++)
        //                                {
        //                                    var user = userTemp.FirstOrDefault(d => d.Id == records[u].CreatorUserId);
        //                                    var username = "";
        //                                    if (user != null) username = user.Surname + user.Name;
        //                                    switch (records[u].Status)
        //                                    {
        //                                        case 0:
        //                                            inspectionStandardDesc.CauseAnalysis = records[u].Remark;
        //                                            _iOperationHistoryAppService.InsertOperationLogNew(inspectionStandardDesc.Id, BusinessTypes.异常管理, OperationTypes.发起异常, username + "在" + records[u].CreationTime + "发起异常");
        //                                            break;
        //                                        case 1:
        //                                            inspectionStandardDesc.TreatmentMeasures = records[u].Remark;
        //                                            inspectionStandardDesc.HandlerId = records[u].CreatorUserId;
        //                                            _iOperationHistoryAppService.InsertOperationLogNew(inspectionStandardDesc.Id, BusinessTypes.异常管理, OperationTypes.处理异常, username + "在" + records[u].CreationTime + "开始处理");
        //                                            break;
        //                                        case 2:
        //                                            inspectionStandardDesc.ConfirmSuggest = records[u].Remark;
        //                                            _iOperationHistoryAppService.InsertOperationLogNew(inspectionStandardDesc.Id, BusinessTypes.异常管理, OperationTypes.驳回异常, username + "在" + records[u].CreationTime + "驳回异常");
        //                                            break;
        //                                        case 3:
        //                                            inspectionStandardDesc.ConfirmSuggest = records[u].Remark;
        //                                            inspectionStandardDesc.ConfirmerId = records[u].CreatorUserId;
        //                                            inspectionStandardDesc.ConfirmTime = records[u].CreationTime;
        //                                            inspectionStandardDesc.CostTime = (records[u].CreationTime - item.CreationTime).TotalHours.ToString();
        //                                            _iOperationHistoryAppService.InsertOperationLogNew(inspectionStandardDesc.Id, BusinessTypes.异常管理, OperationTypes.完成, username + "在" + records[u].CreationTime + "完成处理");
        //                                            break;
        //                                    }
        //                                }
        //                            }
        //                            await _inspectionStandardDescRepository.InsertAsync(inspectionStandardDesc);
        //                            //图片处理
        //                            if (!string.IsNullOrEmpty(item.MediaFiles))
        //                            {
        //                                var picture = item.MediaFiles.Split(',');
        //                                for (int u = 0; u < picture.Count(); u++)
        //                                {
        //                                    UploadPicture uploadPicture = new UploadPicture()
        //                                    {
        //                                        Id = Guid.NewGuid(),
        //                                        BusinessId = inspectionStandardDesc.Id,
        //                                        Organization = (Inspection.Organizations)1,
        //                                        Group = (Groups)1,
        //                                        FileName = picture[u],
        //                                    };
        //                                    await _uploadPictureRepository.InsertAsync(uploadPicture);
        //                                }
        //                            }
        //                        }
        //                        //有重复数据时更新
        //                        else
        //                        {
        //                            inspectionStandard.InspectionDetails = item.Description;
        //                            inspectionStandard.InspectionDetails = item.Description;
        //                            var severity = _inspectionSeverityDescRepository.FirstOrDefault(s => s.Code == item.Level);
        //                            if (severity != null) inspectionStandard.InspectionSeverityDescId = severity.Id;
        //                            var type = _inspectionSeverityDescRepository.FirstOrDefault(s => s.Code == 0); //先写死,等5G回传修正
        //                            if (type != null) inspectionStandard.InspectionSeverityDescId = type.Id;
        //                            var itemInfo = _inspectionSeverityDescRepository.FirstOrDefault(s => s.Code == 0);//先写死,等5G回传修正
        //                            if (itemInfo != null) inspectionStandard.InspectionSeverityDescId = itemInfo.Id;
        //                            inspectionStandard.FileId = item.FileId;
        //                            inspectionStandard.ProcessId = item.ProcessId;
        //                            inspectionStandard.StepId = item.StepId;
        //                            var process = ReturnBopTaskOutDto.TechniqueTask.ProcessesListDto.FirstOrDefault(s => s.Id == inspectionStandard.ProcessId);
        //                            if (process != null)
        //                            {
        //                                inspectionStandard.ProcessesCode = "工序" + process.ProcessesSequence.ToString();
        //                                inspectionStandard.ProcessesName = process.ProcessesName;
        //                                var workStep = process.WorkStepListDto.FirstOrDefault(d => d.Id == inspectionStandard.StepId);
        //                                if (workStep != null)
        //                                {
        //                                    inspectionStandard.WorkStepCode = "工步" + workStep.WorkStepNumber.ToString();
        //                                }
        //                            }
        //                            if (item.FileExceptionProcessingRecords != null)
        //                            {
        //                                var records = item.FileExceptionProcessingRecords.OrderBy(s => s.CreationTime).ToList();
        //                                var count = records.Count();
        //                                if (records.Count() > 0) inspectionStandard.State = (States)Enum.Parse(typeof(States), records[count - 1].Status.ToString());
        //                                else inspectionStandard.State = States.未处理;
        //                                await _operationLogRepository.DeleteAsync(inspectionStandard.Id);
        //                                _unitOfWorkManager.Current.SaveChanges();
        //                                for (int u = 0; u < count; u++)
        //                                {
        //                                    var user = userTemp.FirstOrDefault(d => d.Id == records[u].CreatorUserId);
        //                                    var username = "";
        //                                    if (user != null) username = user.Surname + user.Name;
        //                                    switch (records[u].Status)
        //                                    {
        //                                        case 0:
        //                                            inspectionStandard.CauseAnalysis = records[u].Remark;
        //                                            _iOperationHistoryAppService.InsertOperationLogNew(inspectionStandard.Id, BusinessTypes.异常管理, OperationTypes.发起异常, user + "在" + records[u].CreationTime + "发起异常");
        //                                            break;
        //                                        case 1:
        //                                            inspectionStandard.TreatmentMeasures = records[u].Remark;
        //                                            inspectionStandard.HandlerId = records[u].CreatorUserId;
        //                                            _iOperationHistoryAppService.InsertOperationLogNew(inspectionStandard.Id, BusinessTypes.异常管理, OperationTypes.处理异常, user + "在" + records[u].CreationTime + "开始处理");
        //                                            break;
        //                                        case 2:
        //                                            inspectionStandard.ConfirmSuggest = records[u].Remark;
        //                                            _iOperationHistoryAppService.InsertOperationLogNew(inspectionStandard.Id, BusinessTypes.异常管理, OperationTypes.驳回异常, user + "在" + records[u].CreationTime + "驳回异常");
        //                                            break;
        //                                        case 3:
        //                                            inspectionStandard.ConfirmSuggest = records[u].Remark;
        //                                            inspectionStandard.ConfirmerId = records[u].CreatorUserId;
        //                                            inspectionStandard.ConfirmTime = records[u].CreationTime;
        //                                            inspectionStandard.CostTime = (records[u].CreationTime - item.CreationTime).TotalHours.ToString();
        //                                            _iOperationHistoryAppService.InsertOperationLogNew(inspectionStandard.Id, BusinessTypes.异常管理, OperationTypes.完成, user + "在" + records[u].CreationTime + "完成处理");
        //                                            break;
        //                                    }
        //                                }
        //                            }
        //                            await _inspectionStandardDescRepository.UpdateAsync(inspectionStandard);
        //                            //图片处理，删除旧的图片信息，重新增加
        //                            await _uploadPictureRepository.DeleteAsync(s => s.BusinessId == inspectionStandard.Id);
        //                            _unitOfWorkManager.Current.SaveChanges();
        //                            if (!string.IsNullOrEmpty(item.MediaFiles))
        //                            {
        //                                var picture = item.MediaFiles.Split(',');
        //                                for (int u = 0; u < picture.Count(); u++)
        //                                {
        //                                    UploadPicture uploadPicture = new UploadPicture()
        //                                    {
        //                                        Id = Guid.NewGuid(),
        //                                        BusinessId = inspectionStandard.Id,
        //                                        Organization = (Inspection.Organizations)1,
        //                                        Group = (Groups)1,
        //                                        FileName = picture[u],
        //                                    };
        //                                    await _uploadPictureRepository.InsertAsync(uploadPicture);
        //                                }
        //                            }
        //                        }
        //                    }
        //                }

        //                List<ProductionScheduler> addSchel = new List<ProductionScheduler>();

        //                if (ReturnBopTaskOutDto.RosterPlans != null)
        //                {
        //                    var workIdList = ReturnBopTaskOutDto.RosterPlans.Where(d => d.StepId != null).ToList();

        //                    var proIdList = ReturnBopTaskOutDto.RosterPlans.Where(d => d.StepId == null).ToList();


        //                    if (workIdList.Count > 0)
        //                    {
        //                        List<Guid?> nodeIds = new List<Guid?>();
        //                        nodeIds = workIdList.Select(d => d.StepId).ToList();
        //                        var schelders = _productionSchedulerRepository.GetAll().Where(d => nodeIds.FindIndex(x => x == d.NodeId) != -1).ToList();
        //                        if (schelders.Count > 0)
        //                        {
        //                            foreach (var item in schelders)
        //                            {
        //                                var tempSchelder = workIdList.Find(d => d.StepId == item.NodeId);
        //                                item.AssemblyStartTime = tempSchelder.StartTime;
        //                                item.AssemblyEndTime = tempSchelder.EndTime;
        //                                item.OrganizationUnitId = tempSchelder.OrganizationUnitId;
        //                                item.OrganizationUnitDesc = tempSchelder.OrganizationUnitDesc;
        //                                item.ProductingStatus = (ProductingStatus.生产中);     //tempSchelder.ProductingStatus;
        //                                item.UserId = tempSchelder.UserId;
        //                                item.WorkingHour = tempSchelder.WorkHour;
        //                                item.PerformanceHour = tempSchelder.WorkHour;
        //                                await _productionSchedulerRepository.UpdateAsync(item);
        //                            }
        //                            var schderIds = schelders.Select(d => d.NodeId).ToList();
        //                            var insertSchders = workIdList.Where(d => schderIds.FindIndex(x => x == d.StepId) == -1).ToList();
        //                            foreach (var item in insertSchders)
        //                            {
        //                                var process = _processesRepository.Get(item.ProcessId.Value);
        //                                ProductionScheduler productionScheduler = new ProductionScheduler();
        //                                productionScheduler.Id = Guid.NewGuid();

        //                                productionScheduler.ParentId = item.ProcessId.Value;
        //                                productionScheduler.NodeId = item.StepId.Value;
        //                                var workTemp = _workStepEntityRepository.Get(item.StepId.Value);
        //                                productionScheduler.WorkStepDrawingNo = "工步" + process.ProcessesSequence + "-" + workTemp.WorkStepNumber.ToString();
        //                                productionScheduler.WorkStepName = workTemp.WorkStepName;
        //                                productionScheduler.DrawingNo = "工序" + process.ProcessesSequence;
        //                                productionScheduler.ProductionName = process.ProcessesName;

        //                                productionScheduler.TechniqueName = techniqueList.TechniqueName;
        //                                productionScheduler.TechniqueNumber = techniqueList.TechniqueNumber;
        //                                productionScheduler.Model = bopDesc.Model;
        //                                productionScheduler.LotNo = bopDesc.LotNo;
        //                                productionScheduler.ModelId = bopDesc.ModelId;
        //                                productionScheduler.LotNoId = bopDesc.LotNoId;
        //                                productionScheduler.WorkingHour = item.WorkHour;
        //                                productionScheduler.PerformanceHour = item.WorkHour;
        //                                productionScheduler.ProductingStatus = (ProductingStatus.生产中);//item.ProductingStatus;
        //                                productionScheduler.ArrangementTime = DateTime.Now;
        //                                productionScheduler.DispatcherId = GetCurrentUser().Id;
        //                                productionScheduler.DispatcherName = GetCurrentUser().Surname + GetCurrentUser().Name;
        //                                await _productionSchedulerRepository.InsertAsync(productionScheduler);
        //                                addSchel.Add(productionScheduler);
        //                            }
        //                        }
        //                        else
        //                        {
        //                            foreach (var item in workIdList)
        //                            {
        //                                var process = _processesRepository.Get(item.ProcessId.Value);
        //                                ProductionScheduler productionScheduler = new ProductionScheduler();
        //                                productionScheduler.Id = Guid.NewGuid();

        //                                productionScheduler.ParentId = item.ProcessId.Value;
        //                                productionScheduler.NodeId = item.StepId.Value;
        //                                var workTemp = _workStepEntityRepository.Get(item.StepId.Value);
        //                                productionScheduler.WorkStepDrawingNo = "工步" + process.ProcessesSequence + "-" + workTemp.WorkStepNumber.ToString();
        //                                productionScheduler.WorkStepName = workTemp.WorkStepName;
        //                                productionScheduler.DrawingNo = "工序" + process.ProcessesSequence;
        //                                productionScheduler.ProductionName = process.ProcessesName;

        //                                productionScheduler.TechniqueName = techniqueList.TechniqueName;
        //                                productionScheduler.TechniqueNumber = techniqueList.TechniqueNumber;
        //                                productionScheduler.Model = bopDesc.Model;
        //                                productionScheduler.LotNo = bopDesc.LotNo;
        //                                productionScheduler.ModelId = bopDesc.ModelId;
        //                                productionScheduler.LotNoId = bopDesc.LotNoId;
        //                                productionScheduler.WorkingHour = item.WorkHour;
        //                                productionScheduler.PerformanceHour = item.WorkHour;//默认绩效工时等于工时
        //                                productionScheduler.ProductingStatus = ProductingStatus.生产中; //(ProductingStatus)item.ProductingStatus;
        //                                productionScheduler.ArrangementTime = DateTime.Now;
        //                                productionScheduler.DispatcherId = GetCurrentUser().Id;
        //                                productionScheduler.DispatcherName = GetCurrentUser().Surname + GetCurrentUser().Name;
        //                                await _productionSchedulerRepository.InsertAsync(productionScheduler);
        //                                addSchel.Add(productionScheduler);
        //                            }

        //                        }
        //                    }
        //                    if (proIdList.Count > 0)
        //                    {
        //                        List<Guid?> nodeIds = new List<Guid?>();
        //                        nodeIds.AddRange(proIdList.Select(d => d.ProcessId));
        //                        var schelders = _productionSchedulerRepository.GetAll().Where(d => nodeIds.FindIndex(x => x == d.NodeId) != -1).ToList();
        //                        if (schelders.Count > 0)
        //                        {
        //                            foreach (var item in schelders)
        //                            {
        //                                var tempSchelder = proIdList.Find(d => d.ProcessId == item.NodeId);
        //                                item.AssemblyStartTime = tempSchelder.StartTime;
        //                                item.AssemblyEndTime = tempSchelder.EndTime;
        //                                item.OrganizationUnitId = tempSchelder.OrganizationUnitId;
        //                                item.OrganizationUnitDesc = tempSchelder.OrganizationUnitDesc;
        //                                item.ProductingStatus = (ProductingStatus.生产中);     //tempSchelder.ProductingStatus;
        //                                item.UserId = tempSchelder.UserId;
        //                                item.WorkingHour = tempSchelder.WorkHour;
        //                                item.PerformanceHour = tempSchelder.WorkHour;
        //                                await _productionSchedulerRepository.UpdateAsync(item);
        //                            }
        //                            var schderIds = schelders.Select(d => d.NodeId).ToList();
        //                            var insertSchders = proIdList.Where(d => schderIds.FindIndex(x => x == d.ProcessId) == -1).ToList();
        //                            foreach (var item in insertSchders)
        //                            {
        //                                var process = _processesRepository.Get(item.ProcessId.Value);
        //                                ProductionScheduler productionScheduler = new ProductionScheduler();
        //                                productionScheduler.Id = Guid.NewGuid();

        //                                productionScheduler.ParentId = ReturnBopTaskOutDto.TechniqueTask.Id;
        //                                productionScheduler.NodeId = item.ProcessId.Value;
        //                                productionScheduler.DrawingNo = "工序" + process.ProcessesSequence;
        //                                productionScheduler.ProductionName = process.ProcessesName;

        //                                productionScheduler.TechniqueName = techniqueList.TechniqueName;
        //                                productionScheduler.TechniqueNumber = techniqueList.TechniqueNumber;
        //                                productionScheduler.Model = bopDesc.Model;
        //                                productionScheduler.LotNo = bopDesc.LotNo;
        //                                productionScheduler.ModelId = bopDesc.ModelId;
        //                                productionScheduler.LotNoId = bopDesc.LotNoId;
        //                                productionScheduler.WorkingHour = item.WorkHour;
        //                                productionScheduler.PerformanceHour = item.WorkHour;
        //                                productionScheduler.ProductingStatus = (ProductingStatus.生产中);//item.ProductingStatus;
        //                                productionScheduler.ArrangementTime = DateTime.Now;
        //                                productionScheduler.DispatcherId = GetCurrentUser().Id;
        //                                productionScheduler.DispatcherName = GetCurrentUser().Surname + GetCurrentUser().Name;
        //                                await _productionSchedulerRepository.InsertAsync(productionScheduler);
        //                                addSchel.Add(productionScheduler);
        //                            }
        //                        }
        //                        else
        //                        {
        //                            foreach (var item in proIdList)
        //                            {
        //                                var process = _processesRepository.Get(item.ProcessId.Value);
        //                                ProductionScheduler productionScheduler = new ProductionScheduler();
        //                                productionScheduler.Id = Guid.NewGuid();

        //                                productionScheduler.ParentId = ReturnBopTaskOutDto.TechniqueTask.Id;
        //                                productionScheduler.NodeId = item.ProcessId.Value;
        //                                productionScheduler.DrawingNo = "工序" + process.ProcessesSequence;
        //                                productionScheduler.ProductionName = process.ProcessesName;

        //                                productionScheduler.TechniqueName = techniqueList.TechniqueName;
        //                                productionScheduler.TechniqueNumber = techniqueList.TechniqueNumber;
        //                                productionScheduler.Model = bopDesc.Model;
        //                                productionScheduler.LotNo = bopDesc.LotNo;
        //                                productionScheduler.ModelId = bopDesc.ModelId;
        //                                productionScheduler.LotNoId = bopDesc.LotNoId;
        //                                productionScheduler.WorkingHour = item.WorkHour;
        //                                productionScheduler.PerformanceHour = item.WorkHour;//默认绩效工时等于工时
        //                                productionScheduler.ProductingStatus = ProductingStatus.生产中; //(ProductingStatus)item.ProductingStatus;
        //                                productionScheduler.ArrangementTime = DateTime.Now;
        //                                productionScheduler.DispatcherId = GetCurrentUser().Id;
        //                                productionScheduler.DispatcherName = GetCurrentUser().Surname + GetCurrentUser().Name;
        //                                await _productionSchedulerRepository.InsertAsync(productionScheduler);
        //                                addSchel.Add(productionScheduler);
        //                            }

        //                        }
        //                    }

        //                }
        //                if (ReturnBopTaskOutDto.FileWorkingHours != null)
        //                {
        //                    foreach (var item in ReturnBopTaskOutDto.FileWorkingHours)
        //                    {
        //                        var process = _processesRepository.Get(item.ProcessId.Value);
        //                        if (item.StepId != null)
        //                        {
        //                            var work = await _workStepEntityRepository.GetAsync(item.StepId.Value);
        //                            var schelderTemp = _productionSchedulerRepository.GetAll().Where(d => d.NodeId == work.Id).FirstOrDefault();
        //                            if (schelderTemp != null)
        //                            {
        //                                await _jobWorkerRepository.DeleteAsync(d => d.TaskId == schelderTemp.Id);
        //                                var totalHour = item.FileWorkingHoursUserRecords.Sum(d => d.Hours);
        //                                if (totalHour == work.WorkStepWorking && work.WorkStepWorking != 0)
        //                                {
        //                                    schelderTemp.ProductingStatus = ProductingStatus.已完成;
        //                                    await _productionSchedulerRepository.UpdateAsync(schelderTemp);
        //                                }
        //                                foreach (var citem in item.FileWorkingHoursUserRecords)
        //                                {
        //                                    JobWorker worker = new JobWorker();
        //                                    worker.TaskId = schelderTemp.Id;
        //                                    worker.UserId = citem.UserId;
        //                                    var user = await _userRepository.FirstOrDefaultAsync(d => d.Id == citem.UserId);
        //                                    if (user != null)
        //                                    {
        //                                        worker.UserName = user.FullName;
        //                                    }
        //                                    worker.PerformanceHour = 0;
        //                                    worker.ReportHour = citem.Hours;
        //                                    worker.ReportTime = citem.CreationTime;
        //                                    worker.PerformanceHour = work.WorkStepWorking;
        //                                    var userOr = await _userOrganizationUnitRepository.FirstOrDefaultAsync(d => d.UserId == citem.UserId);
        //                                    if (userOr != null)
        //                                    {
        //                                        worker.OrganizationUnitId = userOr.OrganizationUnitId;
        //                                        worker.OrganizationUnitDesc = _organizationUnitRepository.Get(worker.OrganizationUnitId).DisplayName;
        //                                    }
        //                                    await _jobWorkerRepository.InsertAsync(worker);
        //                                }
        //                            }
        //                            else
        //                            {
        //                                ProductionScheduler productionScheduler = new ProductionScheduler();
        //                                if (addSchel.FindIndex(d => d.NodeId == item.StepId) != -1)
        //                                {
        //                                    productionScheduler = addSchel.Find(d => d.NodeId == item.StepId);
        //                                }
        //                                else
        //                                {
        //                                    productionScheduler.Id = Guid.NewGuid();
        //                                    productionScheduler.ParentId = item.ProcessId.Value;
        //                                    productionScheduler.NodeId = item.StepId.Value;

        //                                    productionScheduler.WorkStepDrawingNo = "工步" + process.ProcessesSequence + "-" + work.WorkStepNumber.ToString();
        //                                    productionScheduler.WorkStepName = work.WorkStepName;
        //                                    productionScheduler.DrawingNo = "工序" + process.ProcessesSequence;
        //                                    productionScheduler.ProductionName = process.ProcessesName;
        //                                    productionScheduler.TechniqueName = techniqueList.TechniqueName;
        //                                    productionScheduler.TechniqueNumber = techniqueList.TechniqueNumber;
        //                                    productionScheduler.Model = bopDesc.Model;
        //                                    productionScheduler.LotNo = bopDesc.LotNo;
        //                                    productionScheduler.ModelId = bopDesc.ModelId;
        //                                    productionScheduler.LotNoId = bopDesc.LotNoId;
        //                                    productionScheduler.WorkingHour = work.WorkStepWorking;
        //                                    productionScheduler.PerformanceHour = work.WorkStepWorking;//默认绩效工时等于工时

        //                                    var totalHour = item.FileWorkingHoursUserRecords.Sum(d => d.Hours);
        //                                    if (totalHour == work.WorkStepWorking && work.WorkStepWorking != 0)
        //                                    {
        //                                        productionScheduler.ProductingStatus = ProductingStatus.已完成;

        //                                    }
        //                                    else
        //                                    {
        //                                        productionScheduler.ProductingStatus = ProductingStatus.生产中;
        //                                    }

        //                                    productionScheduler.ArrangementTime = DateTime.Now;
        //                                    productionScheduler.DispatcherId = GetCurrentUser().Id;
        //                                    productionScheduler.DispatcherName = GetCurrentUser().Surname + GetCurrentUser().Name;
        //                                    await _productionSchedulerRepository.InsertAsync(productionScheduler);
        //                                }



        //                                foreach (var citem in item.FileWorkingHoursUserRecords)
        //                                {
        //                                    JobWorker worker = new JobWorker();
        //                                    worker.TaskId = productionScheduler.Id;
        //                                    worker.UserId = citem.UserId;
        //                                    var user = await _userRepository.FirstOrDefaultAsync(d => d.Id == citem.UserId);
        //                                    if (user != null)
        //                                    {
        //                                        worker.UserName = user.FullName;
        //                                    }

        //                                    worker.PerformanceHour = 0;
        //                                    worker.ReportHour = citem.Hours;
        //                                    worker.ReportTime = citem.CreationTime;
        //                                    worker.PerformanceHour = work.WorkStepWorking;
        //                                    var userOr = await _userOrganizationUnitRepository.FirstOrDefaultAsync(d => d.UserId == citem.UserId);
        //                                    if (userOr != null)
        //                                    {
        //                                        worker.OrganizationUnitId = userOr.OrganizationUnitId;
        //                                        worker.OrganizationUnitDesc = _organizationUnitRepository.Get(worker.OrganizationUnitId).DisplayName;
        //                                    }
        //                                    await _jobWorkerRepository.InsertAsync(worker);
        //                                }
        //                            }
        //                        }
        //                        else
        //                        {
        //                            var schelderTemp = _productionSchedulerRepository.GetAll().Where(d => d.NodeId == process.Id).FirstOrDefault();
        //                            if (schelderTemp != null)
        //                            {
        //                                await _jobWorkerRepository.DeleteAsync(d => d.TaskId == schelderTemp.Id);
        //                                var totalHour = item.FileWorkingHoursUserRecords.Sum(d => d.Hours);
        //                                if (totalHour == process.ProcessesWorking && process.ProcessesWorking != 0)
        //                                {
        //                                    schelderTemp.ProductingStatus = ProductingStatus.已完成;
        //                                    await _productionSchedulerRepository.UpdateAsync(schelderTemp);
        //                                }
        //                                foreach (var citem in item.FileWorkingHoursUserRecords)
        //                                {
        //                                    JobWorker worker = new JobWorker();
        //                                    worker.TaskId = schelderTemp.Id;
        //                                    worker.UserId = citem.UserId;
        //                                    var user = await _userRepository.FirstOrDefaultAsync(d => d.Id == citem.UserId);
        //                                    if (user != null)
        //                                    {
        //                                        worker.UserName = user.FullName;
        //                                    }
        //                                    worker.PerformanceHour = 0;
        //                                    worker.ReportHour = citem.Hours;
        //                                    worker.ReportTime = citem.CreationTime;
        //                                    worker.PerformanceHour = process.ProcessesWorking;
        //                                    var userOr = await _userOrganizationUnitRepository.FirstOrDefaultAsync(d => d.UserId == citem.UserId);
        //                                    if (userOr != null)
        //                                    {
        //                                        worker.OrganizationUnitId = userOr.OrganizationUnitId;
        //                                        worker.OrganizationUnitDesc = _organizationUnitRepository.Get(worker.OrganizationUnitId).DisplayName;
        //                                    }
        //                                    await _jobWorkerRepository.InsertAsync(worker);
        //                                }
        //                            }
        //                            else
        //                            {
        //                                ProductionScheduler productionScheduler = new ProductionScheduler();
        //                                if (addSchel.FindIndex(d => d.NodeId == item.ProcessId) != -1)
        //                                {
        //                                    productionScheduler = addSchel.Find(d => d.NodeId == item.ProcessId);
        //                                }
        //                                else
        //                                {
        //                                    productionScheduler.Id = Guid.NewGuid();
        //                                    productionScheduler.ParentId = ReturnBopTaskOutDto.TechniqueTask.Id;
        //                                    productionScheduler.NodeId = item.ProcessId.Value;
        //                                    productionScheduler.DrawingNo = "工序" + process.ProcessesSequence;
        //                                    productionScheduler.ProductionName = process.ProcessesName;
        //                                    productionScheduler.TechniqueName = techniqueList.TechniqueName;
        //                                    productionScheduler.TechniqueNumber = techniqueList.TechniqueNumber;
        //                                    productionScheduler.Model = bopDesc.Model;
        //                                    productionScheduler.LotNo = bopDesc.LotNo;
        //                                    productionScheduler.ModelId = bopDesc.ModelId;
        //                                    productionScheduler.LotNoId = bopDesc.LotNoId;
        //                                    productionScheduler.WorkingHour = process.ProcessesWorking;
        //                                    productionScheduler.PerformanceHour = process.ProcessesWorking;//默认绩效工时等于工时
        //                                    var totalHour = item.FileWorkingHoursUserRecords.Sum(d => d.Hours);
        //                                    if (totalHour == process.ProcessesWorking && process.ProcessesWorking != 0)
        //                                    {
        //                                        productionScheduler.ProductingStatus = ProductingStatus.已完成;

        //                                    }
        //                                    else
        //                                    {
        //                                        productionScheduler.ProductingStatus = ProductingStatus.生产中;
        //                                    }
        //                                    productionScheduler.ArrangementTime = DateTime.Now;
        //                                    productionScheduler.DispatcherId = GetCurrentUser().Id;
        //                                    productionScheduler.DispatcherName = GetCurrentUser().Surname + GetCurrentUser().Name;
        //                                    await _productionSchedulerRepository.InsertAsync(productionScheduler);
        //                                }

        //                                foreach (var citem in item.FileWorkingHoursUserRecords)
        //                                {
        //                                    JobWorker worker = new JobWorker();
        //                                    worker.TaskId = productionScheduler.Id;
        //                                    worker.UserId = citem.UserId;
        //                                    var user = await _userRepository.FirstOrDefaultAsync(d => d.Id == citem.UserId);
        //                                    if (user != null)
        //                                    {
        //                                        worker.UserName = user.FullName;
        //                                    }
        //                                    worker.PerformanceHour = 0;
        //                                    worker.ReportHour = citem.Hours;
        //                                    worker.PerformanceHour = process.ProcessesWorking;
        //                                    worker.ReportTime = citem.CreationTime;
        //                                    var userOr = await _userOrganizationUnitRepository.FirstOrDefaultAsync(d => d.UserId == citem.UserId);
        //                                    if (userOr != null)
        //                                    {
        //                                        worker.OrganizationUnitId = userOr.OrganizationUnitId;
        //                                        worker.OrganizationUnitDesc = _organizationUnitRepository.Get(worker.OrganizationUnitId).DisplayName;
        //                                    }
        //                                    await _jobWorkerRepository.InsertAsync(worker);
        //                                }
        //                            }
        //                        }

        //                    }


        //                }

        //            }
        //            catch (Exception ex)
        //            {
        //                message = ex.Message;
        //                return message;

        //            }
        //        }
        //        return message;
        //    }
        //    else
        //    {
        //        message = "传入数据有误！请检查无误后重新尝试！";
        //        return message;
        //    }
        //}

        [UnitOfWork(false)]
        private async Task deleteEditFile(Guid guid)
        {
            using (var unitofwork = _unitOfWorkManager.Begin(System.Transactions.TransactionScopeOption.RequiresNew))
            {
                #region 清空记录Pad端传入日志记录的信息
                List<EditFileProcess> editFileProcesses = new List<EditFileProcess>();
                editFileProcesses = (from cc in _editFileProcessRepository.GetAll().Where(d => d.FileProcessSpecificationId == guid)
                                     select cc).ToList();
                if (editFileProcesses.Count() > 0)
                {
                    foreach (var item in editFileProcesses)
                    {
                        _editFileProcessRepository.HardDelete(item);
                    }
                    unitofwork.Complete();
                    //_unitOfWorkManager.Current.SaveChanges();
                }
                #endregion
               // unitofwork.Complete();
            }

        }
        /// <summary>
        /// 靶场pad回传 加版本删除
        /// </summary>
        /// <param name="guid"></param>
        /// <param name="num"></param>
        /// <returns></returns>
        [UnitOfWork(false)]
        private async Task deleteEditFile(Guid guid,string num)
        {
            using (var unitofwork = _unitOfWorkManager.Begin(System.Transactions.TransactionScopeOption.RequiresNew))
            {
                #region 清空记录Pad端传入日志记录的信息
                List<EditFileProcess> editFileProcesses = new List<EditFileProcess>();
                editFileProcesses = (from cc in _editFileProcessRepository.GetAll().Where(d => d.FileProcessSpecificationId == guid && d._editVersion ==num)
                                     select cc).ToList();
                if (editFileProcesses.Count() > 0)
                {
                    foreach (var item in editFileProcesses)
                    {
                        _editFileProcessRepository.HardDelete(item);
                    }
                    //_unitOfWorkManager.Current.SaveChanges();
                    unitofwork.Complete();
                }
                #endregion
              
            }

        }
        [UnitOfWork(false)]
        private void deleteClearSignatureRecord(Guid guid)
        {
            using (var unitofwork = _unitOfWorkManager.Begin(System.Transactions.TransactionScopeOption.RequiresNew))
            {
                #region 清空记录Pad端传入日志记录的信息
                var clearSignatureRecordList = (from cc in _clearSignatureRecordRepository.GetAllIncluding(a => a.ClearSignatureRowDatas, b => b.ClearSignatureDataStruces).Where(d => d.FileId == guid)
                                                select cc).ToList();
                if (clearSignatureRecordList.Count() > 0)
                {
                    foreach (var item in clearSignatureRecordList)
                    {
                        _clearSignatureRecordRepository.HardDelete(item);

                    }
                    unitofwork.Complete();
                    // _unitOfWorkManager.Current.SaveChanges();
                }
                #endregion
          
            }

        }
 
        private async Task<Guid> InsertAll(TechniqueReturnDto TechniqueEntity, RTechniqueEntity technique)
        {
                //insertallfor循环放到这里
                foreach (var processesDto in TechniqueEntity.ProcessesListDto)
                {
                    var proDto = ObjectMapper.Map<RProcessesEntity>(processesDto);
                    proDto.RTechniqueEntityId = technique.Id;
                    proDto.ProcessesEntityId = processesDto.Id;
                    proDto.Id = Guid.NewGuid();
                    proDto.WorkStepEntities = new List<RWorkStepEntity>();
                    technique.ProcessesEntities.Add(proDto);
                    foreach (var workStepDto in processesDto.WorkStepListDto)
                    {

                    var workStep = ObjectMapper.Map<RWorkStepEntity>(workStepDto);
                    workStep.RTechniqueEntityId = technique.Id;
                    workStep.RProcessesEntityId = proDto.Id;
                    workStep.WorkStepEntityId = workStep.Id;
                    workStep.Id = Guid.NewGuid();
                    if (workStepDto.WorkStepUpdateContent != null)
                    {
                        workStep.WorkStepContent = workStepDto.WorkStepUpdateContent;
                        workStep.WorkStepName = "";
                    }
                    proDto.WorkStepEntities.Add(workStep);
                    if (workStepDto.ManufacturingResources != null && workStepDto.ManufacturingResources.Count > 0)
                    {
                        foreach (var item in workStepDto.ManufacturingResources)
                        {
                            var makeResources = ObjectMapper.Map<RMakeResourcesEntity>(item);
                            makeResources.RWorkStepEntityId = workStep.Id;
                            makeResources.Id = Guid.NewGuid();
                            await _makeResourcesEntityRepository.InsertAsync(makeResources);
                        }
                    }
                    if (workStepDto.InsertDetails != null && workStepDto.InsertDetails.Count > 0)
                    {
                        foreach (var item in workStepDto.InsertDetails)
                        {
                            var loadPiece = ObjectMapper.Map<RLoadPieceEntity>(item);
                            loadPiece.RWorkStepEntityId = workStep.Id;
                            loadPiece.Id = Guid.NewGuid();
                            await _loadPieceRepository.InsertAsync(loadPiece);
                        }
                    }
                    if (workStepDto.Video != null && workStepDto.Video.Count > 0)
                    {
                        foreach (var item in workStepDto.Video)
                        {
                            var video = ObjectMapper.Map<RVideoEntity>(item);
                            video.RWorkStepEntityId = workStep.Id;
                            video.Id = Guid.NewGuid();
                            await _videoEntityRepository.InsertAsync(video);
                        }
                    }

                    //var workStep = ObjectMapper.Map<RWorkStepEntity>(workStepDto);
                    //workStep.RTechniqueEntityId = technique.Id;
                    //workStep.RProcessesEntityId = proDto.Id;
                    //workStep.WorkStepEntityId = workStep.Id;
                    //workStep.Id = Guid.NewGuid();
                    //if (workStepDto.WorkStepUpdateContent != null)
                    //{
                    //    workStep.WorkStepContent = workStepDto.WorkStepUpdateContent;
                    //    workStep.WorkStepName = "";
                    //}
                    //proDto.WorkStepEntities.Add(workStep);
                    //if (workStepDto.ManufacturingResources != null && workStepDto.ManufacturingResources.Count > 0)
                    //{
                    //    List<RMakeResourcesEntity> rMakeResources = new List<RMakeResourcesEntity>();
                    //    foreach (var item in workStepDto.ManufacturingResources)
                    //    {
                    //        var makeResources = ObjectMapper.Map<RMakeResourcesEntity>(item);
                    //        makeResources.RWorkStepEntityId = workStep.Id;
                    //        makeResources.Id = Guid.NewGuid();
                    //        rMakeResources.Add(makeResources);

                    //    }
                    //    if (rMakeResources.Count > 0)
                    //    {
                    //        await _makeResourcesEntityRepository.GetDbContext().BulkInsertAsync(rMakeResources);
                    //    }
                    //}
                    //if (workStepDto.InsertDetails != null && workStepDto.InsertDetails.Count > 0)
                    //{
                    //    List<RLoadPieceEntity> rLoadPieces = new List<RLoadPieceEntity>();
                    //    foreach (var item in workStepDto.InsertDetails)
                    //    {
                    //        var loadPiece = ObjectMapper.Map<RLoadPieceEntity>(item);
                    //        loadPiece.RWorkStepEntityId = workStep.Id;
                    //        loadPiece.Id = Guid.NewGuid();
                    //        rLoadPieces.Add(loadPiece);
                    //    }
                    //    if (rLoadPieces.Count > 0)
                    //    {
                    //        await _loadPieceRepository.GetDbContext().BulkInsertAsync(rLoadPieces);
                    //    }
                    //}
                    //if (workStepDto.Video != null && workStepDto.Video.Count > 0)
                    //{
                    //    List<RVideoEntity> rVideos = new List<RVideoEntity>();
                    //    foreach (var item in workStepDto.Video)
                    //    {
                    //        var video = ObjectMapper.Map<RVideoEntity>(item);
                    //        video.RWorkStepEntityId = workStep.Id;
                    //        video.Id = Guid.NewGuid();
                    //        rVideos.Add(video);
                    //    }
                    //    if (rVideos.Count > 0)
                    //    {
                    //        await _videoEntityRepository.GetDbContext().BulkInsertAsync(rVideos);
                    //    }
                    //    //foreach (var item in workStepDto.Video)
                    //    //{
                    //    //    var video = ObjectMapper.Map<RVideoEntity>(item);
                    //    //    video.RWorkStepEntityId = workStep.Id;
                    //    //    video.Id = Guid.NewGuid();
                    //    //    await _videoEntityRepository.InsertAsync(video);
                    //    //}
                    //}

                    try
                        {
                            if (workStepDto.MainParts != null && workStepDto.MainParts.Count > 0)
                            {
                                foreach (var item in workStepDto.MainParts)
                                {
                                    var record = new R具有证明书的主要零件记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.SecondDrawingNum, item.Certificate, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.Remarks);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _mainPartsRepository.InsertAsync(record);
                                }
                            }
                            if (workStepDto.MultimediaRecord != null && workStepDto.MultimediaRecord.Count > 0)
                            {
                                foreach (var item in workStepDto.MultimediaRecord)
                                {
                                    var record = new R通用多媒体记录表(item.SerialNum, item.Sort, workStep.Id, proDto.Id, item.FisrtDrawingNum, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordRequire);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData));
                                    record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
                                    await _multiMediaRepository.InsertAsync(record);
                                }
                            }
                            if (workStepDto.Moment != null && workStepDto.Moment.Count > 0)
                            {
                                foreach (var item in workStepDto.Moment)
                                {
                                    var record = new R力矩记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.SecondDrawingNum, item.ToolUsed, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand, item.ProcessorDemand, item.Remarks);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _momentRepository.InsertAsync(record);
                                }
                            }
                            if (workStepDto.TorqueReCalibration != null && workStepDto.TorqueReCalibration.Count > 0)
                            {
                                foreach (var item in workStepDto.TorqueReCalibration)
                                {
                                    var record = new R通用力矩复校记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.SecondDrawingNum, item.ToolUsed, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.ProcessorDemand, item.Remarks);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _momentRecordRepository.InsertAsync(record);
                                }
                            }
                            if (workStepDto.GeneralRecords != null && workStepDto.GeneralRecords.Count > 0)
                            {
                                foreach (var item in workStepDto.GeneralRecords)
                                {
                                    var record = new R通用记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.RecordElement, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.FirstConfirmResult);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _generalRecordsRepository.InsertAsync(record);
                                }
                            }
                            if (workStepDto.QualityControl != null && workStepDto.QualityControl.Count > 0)
                            {
                                foreach (var item in workStepDto.QualityControl)
                                {
                                    var record = new R质量控制记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordRemark);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _controlrecordRepository.InsertAsync(record);
                                }
                            }
                            if (workStepDto.Assemble != null && workStepDto.Assemble.Count > 0)
                            {
                                foreach (var item in workStepDto.Assemble)
                                {
                                    var record = new R通用总装数据记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FirstDrawingName, item.RecordElement, item.ToolUsed, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand, item.ProcessorDemand, item.Remarks);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                    record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _totalDataRepository.InsertAsync(record);
                                }
                            }
                            if (workStepDto.Hatch != null && workStepDto.Hatch.Count > 0)
                            {
                                foreach (var item in workStepDto.Hatch)
                                {
                                    var record = new R舱口盖开闭记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.ProductNum, item.RecordItem, item.ToolUsed, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _hatchRepository.InsertAsync(record);
                                }
                            }
                            if (workStepDto.GlueSolution != null && workStepDto.GlueSolution.Count > 0)
                            {
                                foreach (var item in workStepDto.GlueSolution)
                                {
                                    var record = new R胶液配比情况记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.FirstDrawingName, item.RecordRemark);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.MeasuredActual);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _liquidRatioRepository.InsertAsync(record);
                                }
                            }
                            if (workStepDto.InCabin != null && workStepDto.InCabin.Count > 0)
                            {
                                foreach (var item in workStepDto.InCabin)
                                {
                                    var record = new R进箱舱登记表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.Model, item.FisrtDrawingNum, item.FirstDrawingName, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordStatus, item.Remarks, item.RecordRequire, item.RecordMainopoint);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData));
                                    await _enterRegisterRepository.InsertAsync(record);
                                }
                            }
                            if (workStepDto.CablePlugWaterFireProofControl != null && workStepDto.CablePlugWaterFireProofControl.Count > 0)
                            {
                                foreach (var item in workStepDto.CablePlugWaterFireProofControl)
                                {
                                    var record = new R电缆插头防水防热记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.SecondDrawingNum, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.Remarks);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _cableRepository.InsertAsync(record);
                                }
                            }
                            if (workStepDto.BellowsDeformation != null && workStepDto.BellowsDeformation.Count > 0)
                            {
                                foreach (var item in workStepDto.BellowsDeformation)
                                {
                                    var record = new R波纹管变形记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ProductNum, item.RecordElement, item.ToolUsed, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.DesignerDemand, item.Remarks);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.ThirdMeasuredValues);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _rippleRepository.InsertAsync(record);
                                }
                            }
                            if (workStepDto.ElectricalConnectInsertion != null && workStepDto.ElectricalConnectInsertion.Count > 0)
                            {
                                foreach (var item in workStepDto.ElectricalConnectInsertion)
                                {
                                    var record = new R电连接器插接记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                    record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo, item.SecondPhotoNo, item.ThirdPhotoNo, item.FourthPhotoNo);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData), item.FourthOperator, GetDateByString(item.FourthOperatorData));
                                    await _connectorRepository.InsertAsync(record);
                                }
                            }
                            //R箭地接口保护件检查记录表 三检
                            if (workStepDto.ArrowInterfaceProtectCheck != null && workStepDto.ArrowInterfaceProtectCheck.Count > 0)
                            {
                                foreach (var item in workStepDto.ArrowInterfaceProtectCheck)
                                {
                                    var record = new R箭地接口保护件检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordMainopoint, item.RecordRequire);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _arrowInterfaceProtectCheckRepository.InsertAsync(record);
                                }
                            }
                            //绝热去除记录表
                            if (workStepDto.AdiabaticRemoval != null && workStepDto.AdiabaticRemoval.Count > 0)
                            {
                                foreach (var item in workStepDto.AdiabaticRemoval)
                                {
                                    var record = new R绝热去除记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductName, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire);
                                    record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _adiabaticRemovalRepository.InsertAsync(record);
                                }
                            }
                            //R箭体称重时多装少装产品记录表
                            if (workStepDto.ArrowScalageProducts != null && workStepDto.ArrowScalageProducts.Count > 0)
                            {
                                foreach (var item in workStepDto.ArrowScalageProducts)
                                {
                                    var record = new R箭体称重时多装少装产品记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.RecordRemark);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.FirstConfirmResult);

                                    await _arrowScalageProductsRepository.InsertAsync(record);
                                }
                            }
                            //舱口盖开闭测试记录表
                            if (workStepDto.HatchOpenShutTest != null && workStepDto.HatchOpenShutTest.Count > 0)
                            {
                                foreach (var item in workStepDto.HatchOpenShutTest)
                                {
                                    var record = new R舱口盖开闭测试记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductName, item.FirstDrawingName, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.Remarks);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _hatchOpenShutTestRepository.InsertAsync(record);
                                }
                            }
                            //产品接地状态检查记录表 有温湿度
                            if (workStepDto.ProductGroundingStatus != null && workStepDto.ProductGroundingStatus.Count > 0)
                            {
                                foreach (var item in workStepDto.ProductGroundingStatus)
                                {
                                    var record = new R产品接地状态检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.ProductNum, item.ToolUsed, item.RecordRemark);

                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.FirstConfirmResult);
                                    record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _productGroundingStatusRepository.InsertAsync(record);
                                }
                            }
                            //强制检验点记录表  有5检 多媒体
                            if (workStepDto.ForcedCheckpoint != null && workStepDto.ForcedCheckpoint.Count > 0)
                            {
                                foreach (var item in workStepDto.ForcedCheckpoint)
                                {
                                    var record = new R强制检验点记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.FirstConfirmResult);
                                    record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData), item.FourthOperator, GetDateByString(item.FourthOperatorData), item.FifthOperator, GetDateByString(item.FifthOperatorData));
                                    await _forcedCheckpointRepository.InsertAsync(record);
                                }
                            }
                            //自动关闭口盖检查记录表
                            if (workStepDto.AutomaticShutoff != null && workStepDto.AutomaticShutoff.Count > 0)
                            {
                                foreach (var item in workStepDto.AutomaticShutoff)
                                {
                                    var record = new R自动关闭口盖检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.RecordItem, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _automaticShutoffRepository.InsertAsync(record);
                                }
                            }
                            //状态检查表
                            if (workStepDto.StatusCheck != null && workStepDto.StatusCheck.Count > 0)
                            {
                                foreach (var item in workStepDto.StatusCheck)
                                {
                                    var record = new R状态检查表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData));
                                    await _statusCheckRepository.InsertAsync(record);
                                }
                            }
                            //问题记录表
                            if (workStepDto.ProblemRecord != null && workStepDto.ProblemRecord.Count > 0)
                            {
                                foreach (var item in workStepDto.ProblemRecord)
                                {
                                    var record = new R问题记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FirstDrawingName, item.RecordElement, item.AbnormalRecord, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.Remarks);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.MeasuredActual);
                                    record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                    await _problemRecordRepository.InsertAsync(record);
                                }
                            }
                            //爆索尺寸测量记录表 _detonatingCableSizeRepository
                            if (workStepDto.DetonatingCableSize != null && workStepDto.DetonatingCableSize.Count > 0)
                            {
                                foreach (var item in workStepDto.DetonatingCableSize)
                                {
                                    var record = new R爆索尺寸测量记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ToolUsed, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.ThirdMeasuredValues);
                                    record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
                                    await _detonatingCableSizeRepository.InsertAsync(record);
                                }
                            }
                            //整流罩星箭分离弹簧压缩数据记录表
                            if (workStepDto.ReleaseSpringCompression != null && workStepDto.ReleaseSpringCompression.Count > 0)
                            {
                                foreach (var item in workStepDto.ReleaseSpringCompression)
                                {
                                    var record = new R整流罩星箭分离弹簧压缩数据记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductName, item.ProductNum, item.ToolUsed, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.ThirdMeasuredValues, item.FourthMeasuredValues);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _releaseSpringCompressionRepository.InsertAsync(record);
                                }
                            }
                            //载荷支架组合体形位数据记录表
                            if (workStepDto.LoadBracket != null && workStepDto.LoadBracket.Count > 0)
                            {
                                foreach (var item in workStepDto.LoadBracket)
                                {
                                    var record = new R载荷支架组合体形位数据记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordItem, item.ToolUsed, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _loadBracketRepository.InsertAsync(record);
                                }
                            }
                            //设计签署总装数据记录表
                            if (workStepDto.DesignGeneralAssemble != null && workStepDto.DesignGeneralAssemble.Count > 0)
                            {
                                foreach (var item in workStepDto.DesignGeneralAssemble)
                                {
                                    var record = new R设计签署总装数据记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FirstDrawingName, item.RecordElement, item.ToolUsed, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand, item.ProcessorDemand, item.Remarks);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                    record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData), item.FourthOperator, GetDateByString(item.FourthOperatorData));
                                    await _designGeneralAssembleRepository.InsertAsync(record);
                                }
                            }
                            //管路活门气密点检查记录表皂泡法
                            if (workStepDto.SoapBubble != null && workStepDto.SoapBubble.Count > 0)
                            {
                                foreach (var item in workStepDto.SoapBubble)
                                {
                                    var record = new R管路活门气密点检查记录表皂泡法(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductNum, item.FisrtDrawingNum, item.SecondDrawingNum, item.RecordElement, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire, item.DesignerDemand, item.ProcessorDemand, item.Remarks);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);

                                    await _soapBubbleRepository.InsertAsync(record);
                                }
                            }
                            //管路活门气密点检查记录表氦质谱法
                            if (workStepDto.HeliumMassSpectrometry != null && workStepDto.HeliumMassSpectrometry.Count > 0)
                            {
                                foreach (var item in workStepDto.HeliumMassSpectrometry)
                                {
                                    var record = new R管路活门气密点检查记录表氦质谱法(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductNum, item.FisrtDrawingNum, item.SecondDrawingNum, item.RecordElement, item.ToolUsed, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire, item.DesignerDemand, item.ProcessorDemand, item.Remarks);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.ThirdMeasuredValues, item.FourthMeasuredValues);
                                    record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity, item.AtmPressure);
                                    await _heliumMassSpectrometryRepository.InsertAsync(record);
                                }
                            }
                            //除了打保险防松外的总装直属件记录表
                            if (workStepDto.FinalAssemblyParts != null && workStepDto.FinalAssemblyParts.Count > 0)
                            {
                                foreach (var item in workStepDto.FinalAssemblyParts)
                                {
                                    var record = new R除了打保险防松外的总装直属件记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductName, item.FisrtDrawingNum, item.SecondDrawingNum, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordMainopoint, item.DesignerDemand);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.MeasuredActual);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _finalAssemblyPartsRepository.InsertAsync(record);
                                }
                            }
                            //传感器安装测试记录情况统计记录表
                            if (workStepDto.SensorInstallation != null && workStepDto.SensorInstallation.Count > 0)
                            {
                                foreach (var item in workStepDto.SensorInstallation)
                                {
                                    var record = new R传感器安装测试记录情况统计记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductNum, item.ParentProductName, item.FisrtDrawingNum, item.FirstDrawingName, item.RecordElement, item.RecordItem, item.ToolUsed, item.SecondToolUsed, item.ThirdToolUsed, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordStatus, item.RecordRequire, item.RecordMainopoint, item.DesignerDemand, item.ProcessorDemand);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues);
                                    record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _sensorInstallationRepository.InsertAsync(record);
                                }
                            }
                            //插头状态检查表
                            if (workStepDto.PlugStatus != null && workStepDto.PlugStatus.Count > 0)
                            {
                                foreach (var item in workStepDto.PlugStatus)
                                {
                                    var record = new R插头状态检查表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordStatus, item.RecordRequire, item.Remarks);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
                                    record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _plugStatusRepository.InsertAsync(record);
                                }
                            }
                            //惯组安装记录表1
                            if (workStepDto.FirstIMUInstallation != null && workStepDto.FirstIMUInstallation.Count > 0)
                            {
                                foreach (var item in workStepDto.FirstIMUInstallation)
                                {
                                    var record = new R惯组安装记录表一(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ToolUsed, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _firstIMUInstallationRepository.InsertAsync(record);
                                }
                            }
                            //惯组安装记录表2
                            if (workStepDto.SecondIMUInstallation != null && workStepDto.SecondIMUInstallation.Count > 0)
                            {
                                foreach (var item in workStepDto.SecondIMUInstallation)
                                {
                                    var record = new R惯组安装记录表二(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ToolUsed, item.RecordItem, item.RecordRemark);

                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _secondIMUInstallationRepository.InsertAsync(record);
                                }
                            }
                            //电缆高度测量记录表
                            if (workStepDto.CableHeight != null && workStepDto.CableHeight.Count > 0)
                            {
                                foreach (var item in workStepDto.CableHeight)
                                {
                                    var record = new R电缆高度测量记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ToolUsed, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _cableHeightRepository.InsertAsync(record);
                                }
                            }
                            //电缆剥线试验记录表低频
                            if (workStepDto.LowFrequencyCableStripping != null && workStepDto.LowFrequencyCableStripping.Count > 0)
                            {
                                foreach (var item in workStepDto.LowFrequencyCableStripping)
                                {
                                    var record = new R电缆剥线试验记录表低频(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ToolUsed, item.SecondToolUsed, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.FirstConfirmResult);
                                    record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _lowFrequencyCableStrippingRepository.InsertAsync(record);
                                }
                            }
                            //压接实验测量记录表低频
                            if (workStepDto.LowCrimpingExperiment != null && workStepDto.LowCrimpingExperiment.Count > 0)
                            {
                                foreach (var item in workStepDto.LowCrimpingExperiment)
                                {
                                    var record = new R压接实验测量记录表低频(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ToolUsed, item.RecordItem, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);

                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _lowCrimpingExperimentRepository.InsertAsync(record);
                                }
                            }
                            //电缆剥线试验记录表高频
                            if (workStepDto.HighFrequencyCableStripping != null && workStepDto.HighFrequencyCableStripping.Count > 0)
                            {
                                foreach (var item in workStepDto.HighFrequencyCableStripping)
                                {
                                    var record = new R电缆剥线试验记录表高频(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ToolUsed, item.SecondToolUsed, item.RecordItem, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.SecondMeasuredValues, item.FirstConfirmResult);
                                    record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData));
                                    await _highFrequencyCableStrippingRepository.InsertAsync(record);
                                }
                            }
                            //仪器接收检查记录表
                            if (workStepDto.InstrumentCheck != null && workStepDto.InstrumentCheck.Count > 0)
                            {
                                foreach (var item in workStepDto.InstrumentCheck)
                                {
                                    var record = new R仪器接收检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.FirstConfirmResult, item.SecondConfirmResult, item.ThirdConfirmResult);

                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));

                                    await _instrumentCheckRepository.InsertAsync(record);
                                }
                            }
                            //电缆接收检查记录表
                            if (workStepDto.CableReceivingInspection != null && workStepDto.CableReceivingInspection.Count > 0)
                            {
                                foreach (var item in workStepDto.CableReceivingInspection)
                                {
                                    var record = new R电缆接收检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult, item.SecondConfirmResult, item.ThirdConfirmResult);

                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));

                                    await _cableReceivingInspectionRepository.InsertAsync(record);
                                }
                            }
                            //通用检查记录表
                            if (workStepDto.InspectionRecord != null && workStepDto.InspectionRecord.Count > 0)
                            {
                                foreach (var item in workStepDto.InspectionRecord)
                                {
                                    var record = new R通用检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductName, item.RecordItem, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);

                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));

                                    await _inspectionRecordRepository.InsertAsync(record);
                                }
                            }
                            //对接面形位记录表
                            if (workStepDto.DockSurfaceMorpheme != null && workStepDto.DockSurfaceMorpheme.Count > 0)
                            {
                                foreach (var item in workStepDto.DockSurfaceMorpheme)
                                {
                                    var record = new R对接面形位记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductName, item.ParentProductName, item.ToolUsed, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);

                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
                                    await _dockSurfaceMorphemeRepository.InsertAsync(record);
                                }
                            }
                            //整流罩锉修记录表
                            if (workStepDto.FilingFileRepair != null && workStepDto.FilingFileRepair.Count > 0)
                            {
                                foreach (var item in workStepDto.FilingFileRepair)
                                {
                                    var record = new R整流罩锉修记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);

                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.MeasuredActual);

                                    await _filingFileRepairRepository.InsertAsync(record);
                                }
                            }
                            //整流罩安装后检查记录表
                            if (workStepDto.CheckFairingAfterInstallation != null && workStepDto.CheckFairingAfterInstallation.Count > 0)
                            {
                                foreach (var item in workStepDto.CheckFairingAfterInstallation)
                                {
                                    var record = new R整流罩安装后检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FirstDrawingName, item.RecordRemark);

                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.MeasuredActual, item.FirstConfirmResult);

                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));

                                    await _checkFairingAfterInstallationRepository.InsertAsync(record);
                                }
                            }
                            //导管检查记录表
                            if (workStepDto.Catheterization != null && workStepDto.Catheterization.Count > 0)
                            {
                                foreach (var item in workStepDto.Catheterization)
                                {
                                    var record = new R导管检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);

                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.MeasuredActual);
                                    record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData), item.FourthOperator, GetDateByString(item.FourthOperatorData));
                                    await _catheterizationRepository.InsertAsync(record);
                                }
                            }
                            //管路上箭前吹除记录表
                            if (workStepDto.BlowPipeArrow != null && workStepDto.BlowPipeArrow.Count > 0)
                            {
                                foreach (var item in workStepDto.BlowPipeArrow)
                                {
                                    var record = new R管路上箭前吹除记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);

                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.FirstConfirmResult);
                                    record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _blowPipeArrowRepository.InsertAsync(record);
                                }
                            }
                            //气封管流量测试记录表
                            if (workStepDto.GasPipeTest != null && workStepDto.GasPipeTest.Count > 0)
                            {
                                foreach (var item in workStepDto.GasPipeTest)
                                {
                                    var record = new R气封管流量测试记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ToolUsed, item.FisrtDrawingNum, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.ProcessorDemand, item.RecordRequire);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.ThirdMeasuredValues, item.FourthMeasuredValues);
                                    record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _gasPipeTestRepository.InsertAsync(record);
                                }
                            }
                            //阀门气瓶过滤器流量计输送管金属软管等检查记录表
                            if (workStepDto.ValvesGasInspection != null && workStepDto.ValvesGasInspection.Count > 0)
                            {
                                foreach (var item in workStepDto.ValvesGasInspection)
                                {
                                    var record = new R阀门气瓶过滤器流量计输送管金属软管等检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.ProductNum, item.RecordElement, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordStatus);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
                                    record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _valvesGasInspectionRepository.InsertAsync(record);
                                }
                            }
                            //单机安装位置记录表
                            if (workStepDto.InstallationLocation != null && workStepDto.InstallationLocation.Count > 0)
                            {
                                foreach (var item in workStepDto.InstallationLocation)
                                {
                                    var record = new R单机安装位置记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ProductNum, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);

                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _installationLocationRepository.InsertAsync(record);
                                }
                            }
                            //安装距离记录表
                            if (workStepDto.InstallationDistance != null && workStepDto.InstallationDistance.Count > 0)
                            {
                                foreach (var item in workStepDto.InstallationDistance)
                                {
                                    var record = new R安装距离记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordElement, item.ToolUsed, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordRequire);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);

                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _installationDistanceRepository.InsertAsync(record);
                                }
                            }
                            //小导管卡箍间距测量表
                            if (workStepDto.MeasurementSpacingConduit != null && workStepDto.MeasurementSpacingConduit.Count > 0)
                            {
                                foreach (var item in workStepDto.MeasurementSpacingConduit)
                                {
                                    var record = new R小导管卡箍间距测量表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ToolUsed, item.FisrtDrawingNum, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordMainopoint);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                    record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _measurementSpacingConduitRepository.InsertAsync(record);
                                }
                            }
                            //未按要求施加力矩及未打保险防松记录表
                            if (workStepDto.FailureAequiredLoosInsurance != null && workStepDto.FailureAequiredLoosInsurance.Count > 0)
                            {
                                foreach (var item in workStepDto.FailureAequiredLoosInsurance)
                                {
                                    var record = new R未按要求施加力矩及未打保险防松记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordMainopoint, item.ProcessorDemand);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.MeasuredActual);

                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _failureAequiredLoosInsuranceRepository.InsertAsync(record);
                                }
                            }
                            //分解重装记录表
                            if (workStepDto.DisassemblyReassembly != null && workStepDto.DisassemblyReassembly.Count > 0)
                            {
                                foreach (var item in workStepDto.DisassemblyReassembly)
                                {
                                    var record = new R分解重装记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordMainopoint, item.RecordRequire);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.MeasuredActual);

                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _disassemblyReassemblyRepository.InsertAsync(record);
                                }
                            }
                            //配合七零三绝热记录表
                            if (workStepDto.Insulation703 != null && workStepDto.Insulation703.Count > 0)
                            {
                                foreach (var item in workStepDto.Insulation703)
                                {
                                    var record = new R配合七零三绝热记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FirstDrawingName, item.ParentProductName, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordMainopoint);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);

                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _insulation703Repository.InsertAsync(record);
                                }
                            }
                            //连续拧紧环节力矩复校记录表
                            if (workStepDto.CalibrationContinuousTorque != null && workStepDto.CalibrationContinuousTorque.Count > 0)
                            {
                                foreach (var item in workStepDto.CalibrationContinuousTorque)
                                {
                                    var record = new R连续拧紧环节力矩复校记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.SecondDrawingNum, item.ToolUsed, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.DesignerDemand, item.ProcessorDemand);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues);

                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _calibrationContinuousTorqueRepository.InsertAsync(record);
                                }
                            }
                            //管路垫块安装情况记录表
                            if (workStepDto.InstallationPipeCushion != null && workStepDto.InstallationPipeCushion.Count > 0)

                            {
                                foreach (var item in workStepDto.InstallationPipeCushion)
                                {
                                    var record = new R管路垫块安装情况记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordMainopoint);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.MeasuredActual);

                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _installationPipeCushionRepository.InsertAsync(record);
                                }
                            }
                            //箭体结构防水记录表
                            if (workStepDto.ArrowStructureWaterproof != null && workStepDto.ArrowStructureWaterproof.Count > 0)

                            {
                                foreach (var item in workStepDto.ArrowStructureWaterproof)
                                {
                                    var record = new R箭体结构防水记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ParentProductName, item.RecordElement, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand, item.Remarks);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);

                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _arrowStructureWaterproofRepository.InsertAsync(record);
                                }
                            }
                            //搭接线安装部位防水记录表
                            if (workStepDto.WaterproofInstallationLapd != null && workStepDto.WaterproofInstallationLapd.Count > 0)

                            {
                                foreach (var item in workStepDto.WaterproofInstallationLapd)
                                {
                                    var record = new R搭接线安装部位防水记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductName, item.RecordElement, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand, item.Remarks);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.FirstConfirmResult);

                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _waterproofInstallationLapdRepository.InsertAsync(record);
                                }
                            }
                            //总装零件称重记录表
                            if (workStepDto.Assemnleweighing != null && workStepDto.Assemnleweighing.Count > 0)

                            {
                                foreach (var item in workStepDto.Assemnleweighing)
                                {
                                    var record = new R总装零件称重记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.ToolUsed, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues);

                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _assemnleweighingRepository.InsertAsync(record);
                                }
                            }
                            //箭体称重记录表 ArrowWeight
                            if (workStepDto.ArrowWeight != null && workStepDto.ArrowWeight.Count > 0)

                            {
                                foreach (var item in workStepDto.ArrowWeight)
                                {
                                    var record = new R箭体称重记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductName, item.RecordElement, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire, item.RecordStatus);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                    record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _arrowWeightRepository.InsertAsync(record);
                                }
                            }
                            //总装耗材称重记录表
                            if (workStepDto.GeneralWeighing != null && workStepDto.GeneralWeighing.Count > 0)

                            {
                                foreach (var item in workStepDto.GeneralWeighing)
                                {
                                    var record = new R总装耗材称重记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.ToolUsed, item.RecordRemark);

                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.ThirdMeasuredValues, item.FourthMeasuredValues);

                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _generalWeighingRepository.InsertAsync(record);
                                }
                            }
                            //飞行质量质心设备调平数据记录表
                            if (workStepDto.LevelingDataFlight != null && workStepDto.LevelingDataFlight.Count > 0)

                            {
                                foreach (var item in workStepDto.LevelingDataFlight)
                                {
                                    var record = new R飞行质量质心设备调平数据记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);


                                    await _levelingDataFlightRepository.InsertAsync(record);
                                }
                            }
                            //飞行质量质心皮重及参数记录表
                            if (workStepDto.FlightMassCentroidTareWeight != null && workStepDto.FlightMassCentroidTareWeight.Count > 0)

                            {
                                foreach (var item in workStepDto.FlightMassCentroidTareWeight)
                                {
                                    var record = new R飞行质量质心皮重及参数记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.RecordItem, item.RecordRemark);

                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);


                                    await _flightMassCentroidTareWeightRepository.InsertAsync(record);
                                }
                            }
                            //横向质心测量记录表
                            if (workStepDto.TransverseCentroid != null && workStepDto.TransverseCentroid.Count > 0)

                            {
                                foreach (var item in workStepDto.TransverseCentroid)
                                {
                                    var record = new R横向质心测量记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.ThirdMeasuredValues, item.FourthMeasuredValues);


                                    await _transverseCentroidRepository.InsertAsync(record);
                                }
                            }
                            //大部段称重记录表
                            if (workStepDto.LargeSectionWeight != null && workStepDto.LargeSectionWeight.Count > 0)

                            {
                                foreach (var item in workStepDto.LargeSectionWeight)
                                {
                                    var record = new R大部段称重记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ToolUsed, item.RecordElement, item.RecordRemark);

                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                    record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);

                                    await _largeSectionWeightRepository.InsertAsync(record);
                                }
                            }
                            // 产品安装确认表
                            if (workStepDto.ProductInstallationConfirmation != null && workStepDto.ProductInstallationConfirmation.Count > 0)

                            {
                                foreach (var item in workStepDto.ProductInstallationConfirmation)
                                {
                                    var record = new R产品安装确认表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.ProcessorDemand, item.Remarks);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.MeasuredActual);


                                    await _productInstallationConfirmationRepository.InsertAsync(record);
                                }
                            }
                            //阀门安装状态确认表
                            if (workStepDto.ConfirmationStatus != null && workStepDto.ConfirmationStatus.Count > 0)

                            {
                                foreach (var item in workStepDto.ConfirmationStatus)
                                {
                                    var record = new R阀门安装状态确认表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.FisrtDrawingNum, item.FirstDrawingName, item.ProductNum, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.Remarks);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);


                                    await _confirmationStatusRepository.InsertAsync(record);
                                }
                            }
                            //接收检查记录表
                            if (workStepDto.ReceivingInspectionRecord != null && workStepDto.ReceivingInspectionRecord.Count > 0)

                            {
                                foreach (var item in workStepDto.ReceivingInspectionRecord)
                                {
                                    var record = new R通用接收检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire);
                                    record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.MeasuredActual);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));

                                    await _receivingInspectionRecordRepository.InsertAsync(record);
                                }
                            }
                            //通用保护件检查记录表
                            if (workStepDto.ProtectiveParts != null && workStepDto.ProtectiveParts.Count > 0)

                            {
                                foreach (var item in workStepDto.ProtectiveParts)
                                {
                                    var record = new R通用保护件检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FirstDrawingName, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordStatus, item.RecordRequire);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult, item.MeasuredActual);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));

                                    await _protectivePartsRepository.InsertAsync(record);
                                }
                            }
                            //接口检查记录表
                            if (workStepDto.InterfaceCheck != null && workStepDto.InterfaceCheck.Count > 0)

                            {
                                foreach (var item in workStepDto.InterfaceCheck)
                                {
                                    var record = new R接口检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult, item.MeasuredActual);
                                    record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));

                                    await _interfaceCheckRepository.InsertAsync(record);
                                }
                            }
                            //象限标识检查记录表
                            if (workStepDto.QuadrantCheck != null && workStepDto.QuadrantCheck.Count > 0)

                            {
                                foreach (var item in workStepDto.QuadrantCheck)
                                {
                                    var record = new R象限标识检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordRequire, item.Remarks);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.FirstConfirmResult);
                                    await _quadrantCheckRepository.InsertAsync(record);
                                }
                            }
                            //干燥剂检查记录表
                            if (workStepDto.DesiccantInspection != null && workStepDto.DesiccantInspection.Count > 0)

                            {
                                foreach (var item in workStepDto.DesiccantInspection)
                                {
                                    var record = new R干燥剂检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.Remarks);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.MeasuredActual);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _desiccantInspectionRepository.InsertAsync(record);
                                }
                            }
                            //随大部段交付产品明细表
                            if (workStepDto.LargePartsDelivery != null && workStepDto.LargePartsDelivery.Count > 0)

                            {
                                foreach (var item in workStepDto.LargePartsDelivery)
                                {
                                    var record = new R随大部段交付产品明细表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand, item.Remarks);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);

                                    await _largePartsDeliveryRepository.InsertAsync(record);
                                }
                            }
                            //气瓶组充放气速率记录表
                            if (workStepDto.CylinderGroup != null && workStepDto.CylinderGroup.Count > 0)

                            {
                                foreach (var item in workStepDto.CylinderGroup)
                                {
                                    var record = new R气瓶组充放气速率记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ToolUsed, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.ThirdMeasuredValues, item.FourthMeasuredValues);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _cylinderGroupRepository.InsertAsync(record);
                                }
                            }
                            //系统保压记录表
                            if (workStepDto.SystemPressureMaintaining != null && workStepDto.SystemPressureMaintaining.Count > 0)

                            {
                                foreach (var item in workStepDto.SystemPressureMaintaining)
                                {
                                    var record = new R系统保压记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FirstDrawingName, item.ToolUsed, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordStatus, item.DesignerDemand, item.RecordRequire);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues);
                                    record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
                                    await _systemPressureMaintainingRepository.InsertAsync(record);
                                }
                            }
                            //气瓶压力测试记录表
                            if (workStepDto.CylinderPressureTest != null && workStepDto.CylinderPressureTest.Count > 0)

                            {
                                foreach (var item in workStepDto.CylinderPressureTest)
                                {
                                    var record = new R气瓶压力测试记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FirstDrawingName, item.ToolUsed, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand, item.Remarks);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);

                                    await _cylinderPressureTestRepository.InsertAsync(record);
                                }
                            }
                            //阀门使用次数记录表
                            if (workStepDto.ValveUsageTimes != null && workStepDto.ValveUsageTimes.Count > 0)

                            {
                                foreach (var item in workStepDto.ValveUsageTimes)
                                {
                                    var record = new R阀门使用次数记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ProductNum, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand, item.RecordStatus);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _valveUsageTimesRepository.InsertAsync(record);
                                }
                            }
                            //阀门测试记录表
                            if (workStepDto.ValveTest != null && workStepDto.ValveTest.Count > 0)

                            {
                                foreach (var item in workStepDto.ValveTest)
                                {
                                    var record = new R阀门测试记录表一(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ProductNum, item.FirstDrawingName, item.RecordElement, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire, item.RecordStatus, item.Remarks);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                    record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _valveTestRepository.InsertAsync(record);
                                }
                            }
                            //气封流量测试记录表
                            if (workStepDto.GasSealFlowTest != null && workStepDto.GasSealFlowTest.Count > 0)

                            {
                                foreach (var item in workStepDto.GasSealFlowTest)
                                {
                                    var record = new R气封流量测试记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FirstDrawingName, item.ToolUsed, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.ThirdMeasuredValues);
                                    record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _gasSealFlowTestRepository.InsertAsync(record);
                                }
                            }
                            //阀门测试记录表2
                            if (workStepDto.ValveTestSec != null && workStepDto.ValveTestSec.Count > 0)

                            {
                                foreach (var item in workStepDto.ValveTestSec)
                                {
                                    var record = new R阀门测试记录表二(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ProductNum, item.FirstDrawingName, item.RecordElement, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire, item.RecordStatus, item.Remarks);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues);
                                    record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _valveTestSecRepository.InsertAsync(record);
                                }
                            }
                            //电磁阀尾罩检查表
                            if (workStepDto.TailCoverSolenoid != null && workStepDto.TailCoverSolenoid.Count > 0)

                            {
                                foreach (var item in workStepDto.TailCoverSolenoid)
                                {
                                    var record = new R电磁阀尾罩检查表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordRequire, item.Remarks);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _tailCoverSolenoidRepository.InsertAsync(record);
                                }
                            }
                            //传感器变换器对应关系确认记录表
                            if (workStepDto.CorrespondingRelationship != null && workStepDto.CorrespondingRelationship.Count > 0)

                            {
                                foreach (var item in workStepDto.CorrespondingRelationship)
                                {
                                    var record = new R传感器变换器对应关系确认记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ParentProductNum, item.ParentProductName, item.SecondDrawingNum, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordRequire, item.RecordStatus, item.RecordMainopoint);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _correspondingRelationshipRepository.InsertAsync(record);
                                }
                            }
                            //产品安装数量记录表
                            if (workStepDto.InstallationQuantity != null && workStepDto.InstallationQuantity.Count > 0)

                            {
                                foreach (var item in workStepDto.InstallationQuantity)
                                {
                                    var record = new R产品安装数量记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.RecordRemark);

                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _installationQuantityRepository.InsertAsync(record);
                                }
                            }
                            //液位传感器尺寸协调记录表
                            if (workStepDto.LiquidLevelSensor != null && workStepDto.LiquidLevelSensor.Count > 0)

                            {
                                foreach (var item in workStepDto.LiquidLevelSensor)
                                {
                                    var record = new R液位传感器尺寸协调记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.ToolUsed, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues);
                                    record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _liquidLevelSensorRepository.InsertAsync(record);
                                }
                            }
                            //密封插头压接多媒体记录表
                            if (workStepDto.CrimpingSealedPlug != null && workStepDto.CrimpingSealedPlug.Count > 0)

                            {
                                foreach (var item in workStepDto.CrimpingSealedPlug)
                                {
                                    var record = new R密封插头压接多媒体记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ParentProductNum, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordMainopoint, item.Remarks);
                                    record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData), item.FourthOperator, GetDateByString(item.FourthOperatorData));
                                    await _crimpingSealedPlugRepository.InsertAsync(record);
                                }
                            }
                            //岗位分工表
                            if (workStepDto.JobDivision != null && workStepDto.JobDivision.Count > 0)

                            {
                                foreach (var item in workStepDto.JobDivision)
                                {
                                    var record = new R岗位分工表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordRemark);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.MeasuredActual);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData), item.FourthOperator, GetDateByString(item.FourthOperatorData));
                                    await _jobDivisionRepository.InsertAsync(record);
                                }
                            }
                            //低频压接实验测量记录表
                            if (workStepDto.ExperimentalCrimping != null && workStepDto.ExperimentalCrimping.Count > 0)

                            {
                                foreach (var item in workStepDto.ExperimentalCrimping)
                                {
                                    var record = new R低频压接实验测量记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ToolUsed, item.SecondToolUsed, item.ThirdToolUsed, item.RecordItem, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordRequire, item.RecordStatus, item.RecordMainopoint);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.ThirdMeasuredValues);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _experimentalCrimpingRepository.InsertAsync(record);
                                }
                            }
                            //高频压接点电阻及抗电强度检查记录表
                            if (workStepDto.HighFrequencyVoltage != null && workStepDto.HighFrequencyVoltage.Count > 0)

                            {
                                foreach (var item in workStepDto.HighFrequencyVoltage)
                                {
                                    var record = new R高频压接点电阻及抗电强度检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ToolUsed, item.SecondToolUsed, item.ThirdToolUsed, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordRequire, item.RecordStatus, item.RecordMainopoint);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.ThirdMeasuredValues);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _highFrequencyVoltageRepository.InsertAsync(record);
                                }
                            }
                            //高频压接点抗拉强度检查记录表
                            if (workStepDto.TensileStrengthHigh != null && workStepDto.TensileStrengthHigh.Count > 0)

                            {
                                foreach (var item in workStepDto.TensileStrengthHigh)
                                {
                                    var record = new R高频压接点抗拉强度检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ToolUsed, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire, item.RecordStatus);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _tensileStrengthHighRepository.InsertAsync(record);
                                }
                            }
                            //电连接器插接多媒体记录表
                            if (workStepDto.MultimediaElectricalConnect != null && workStepDto.MultimediaElectricalConnect.Count > 0)

                            {
                                foreach (var item in workStepDto.MultimediaElectricalConnect)
                                {
                                    var record = new R电连接器插接多媒体记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.ProductNum, item.ParamCode, item.RecordRemark);
                                    record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo, item.SecondPhotoNo, item.ThirdPhotoNo, item.FourthPhotoNo);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _dianlianjieqichajieduomeitijilubiaoRepository.InsertAsync(record);
                                }
                            }
                            //仪器安装电缆余量多媒体记录表
                            if (workStepDto.InstrumentCableAllowance != null && workStepDto.InstrumentCableAllowance.Count > 0)

                            {
                                foreach (var item in workStepDto.InstrumentCableAllowance)
                                {
                                    var record = new R仪器安装电缆余量多媒体记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.ProductNum, item.ParamCode, item.RecordRemark);
                                    record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _yiqianzhuangdianlanyuliangduomeitijilubiaoRepository.InsertAsync(record);
                                }
                            }
                            //仪器安装分离钢索多媒体记录表
                            if (workStepDto.InstrumentSeparationCable != null && workStepDto.InstrumentSeparationCable.Count > 0)

                            {
                                foreach (var item in workStepDto.InstrumentSeparationCable)
                                {
                                    var record = new R仪器安装分离钢索多媒体记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.ProductNum, item.ParamCode, item.RecordRemark);
                                    record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _yiqianzhuangfenligangsuoduomeitijilubiaoRepository.InsertAsync(record);
                                }
                            }
                            //仪器安装分离力测试多媒体记录表
                            if (workStepDto.InstrumentSeparationForceTest != null && workStepDto.InstrumentSeparationForceTest.Count > 0)

                            {
                                foreach (var item in workStepDto.InstrumentSeparationForceTest)
                                {
                                    var record = new R仪器安装分离力测试多媒体记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.ProductNum, item.ParamCode, item.RecordRemark);
                                    record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _yiqianzhuangfenliceshiduomeitijilubiaoRepository.InsertAsync(record);
                                }
                            }
                            //仪器安装力矩记录表
                            if (workStepDto.InstrumentTorqueRecord != null && workStepDto.InstrumentTorqueRecord.Count > 0)

                            {
                                foreach (var item in workStepDto.InstrumentTorqueRecord)
                                {
                                    var record = new R仪器安装力矩记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.ProductNum, item.ParamCode, item.ToolUsed, item.RecordRemark);
                                    record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand, item.ProcessorDemand, item.Remarks);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _yiqianzhuanglijvjilubiaoRepository.InsertAsync(record);
                                }
                            }
                            //仪器插座安装多媒体记录表
                            if (workStepDto.MultimediaSheetSocket != null && workStepDto.MultimediaSheetSocket.Count > 0)

                            {
                                foreach (var item in workStepDto.MultimediaSheetSocket)
                                {
                                    var record = new R仪器插座安装多媒体记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.ProductNum, item.ParamCode, item.RecordRemark);
                                    record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                    record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                    record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                    await _yiqichazuoanzhuangduomeitijilubiaoRepository.InsertAsync(record);
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            throw e;// new UserFriendlyException("文件未签署完成！");
                        }
                    }
                }
                var Id = await _rTechniqueRepository.InsertAndGetIdAsync(technique);
                return Id;
        }

        private async Task<Guid> InsertAll_BC(TechniqueReturnDto TechniqueEntity, RTechniqueEntity technique)
        {
            //insertallfor循环放到这里
            foreach (var processesDto in TechniqueEntity.ProcessesListDto)
            {
                var proDto = ObjectMapper.Map<RProcessesEntity>(processesDto);
                proDto.RTechniqueEntityId = technique.Id;
                proDto.ProcessesEntityId = processesDto.Id;
                proDto.Id = Guid.NewGuid();
                proDto.WorkStepEntities = new List<RWorkStepEntity>();
                technique.ProcessesEntities.Add(proDto);
                foreach (var workStepDto in processesDto.WorkStepListDto)
                {

                    var workStep = ObjectMapper.Map<RWorkStepEntity>(workStepDto);
                    workStep.RTechniqueEntityId = technique.Id;
                    workStep.RProcessesEntityId = proDto.Id;
                    workStep.WorkStepEntityId = workStep.Id;
                    workStep.Id = Guid.NewGuid();
                    if (workStepDto.WorkStepUpdateContent != null)
                    {
                        workStep.WorkStepContent = workStepDto.WorkStepUpdateContent;
                        workStep.WorkStepName = "";
                    }
                    proDto.WorkStepEntities.Add(workStep);
                    if (workStepDto.ManufacturingResources != null && workStepDto.ManufacturingResources.Count > 0)
                    {
                        foreach (var item in workStepDto.ManufacturingResources)
                        {
                            var makeResources = ObjectMapper.Map<RMakeResourcesEntity>(item);
                            makeResources.RWorkStepEntityId = workStep.Id;
                            makeResources.Id = Guid.NewGuid();
                            await _makeResourcesEntityRepository.InsertAsync(makeResources);
                        }
                    }
                    if (workStepDto.InsertDetails != null && workStepDto.InsertDetails.Count > 0)
                    {
                        foreach (var item in workStepDto.InsertDetails)
                        {
                            var loadPiece = ObjectMapper.Map<RLoadPieceEntity>(item);
                            loadPiece.RWorkStepEntityId = workStep.Id;
                            loadPiece.Id = Guid.NewGuid();
                            await _loadPieceRepository.InsertAsync(loadPiece);
                        }
                    }
                    if (workStepDto.Video != null && workStepDto.Video.Count > 0)
                    {
                        foreach (var item in workStepDto.Video)
                        {
                            var video = ObjectMapper.Map<RVideoEntity>(item);
                            video.RWorkStepEntityId = workStep.Id;
                            video.Id = Guid.NewGuid();
                            await _videoEntityRepository.InsertAsync(video);
                        }
                    }

                    //var workStep = ObjectMapper.Map<RWorkStepEntity>(workStepDto);
                    //workStep.RTechniqueEntityId = technique.Id;
                    //workStep.RProcessesEntityId = proDto.Id;
                    //workStep.WorkStepEntityId = workStep.Id;
                    //workStep.Id = Guid.NewGuid();
                    //if (workStepDto.WorkStepUpdateContent != null)
                    //{
                    //    workStep.WorkStepContent = workStepDto.WorkStepUpdateContent;
                    //    workStep.WorkStepName = "";
                    //}
                    //proDto.WorkStepEntities.Add(workStep);
                    //if (workStepDto.ManufacturingResources != null && workStepDto.ManufacturingResources.Count > 0)
                    //{
                    //    List<RMakeResourcesEntity> rMakeResources = new List<RMakeResourcesEntity>();
                    //    foreach (var item in workStepDto.ManufacturingResources)
                    //    {
                    //        var makeResources = ObjectMapper.Map<RMakeResourcesEntity>(item);
                    //        makeResources.RWorkStepEntityId = workStep.Id;
                    //        makeResources.Id = Guid.NewGuid();
                    //        rMakeResources.Add(makeResources);

                    //    }
                    //    if (rMakeResources.Count > 0)
                    //    {
                    //        await _makeResourcesEntityRepository.GetDbContext().BulkInsertAsync(rMakeResources);
                    //    }
                    //}
                    //if (workStepDto.InsertDetails != null && workStepDto.InsertDetails.Count > 0)
                    //{
                    //    List<RLoadPieceEntity> rLoadPieces = new List<RLoadPieceEntity>();
                    //    foreach (var item in workStepDto.InsertDetails)
                    //    {
                    //        var loadPiece = ObjectMapper.Map<RLoadPieceEntity>(item);
                    //        loadPiece.RWorkStepEntityId = workStep.Id;
                    //        loadPiece.Id = Guid.NewGuid();
                    //        rLoadPieces.Add(loadPiece);
                    //    }
                    //    if (rLoadPieces.Count > 0)
                    //    {
                    //        await _loadPieceRepository.GetDbContext().BulkInsertAsync(rLoadPieces);
                    //    }
                    //}
                    //if (workStepDto.Video != null && workStepDto.Video.Count > 0)
                    //{
                    //    List<RVideoEntity> rVideos = new List<RVideoEntity>();
                    //    foreach (var item in workStepDto.Video)
                    //    {
                    //        var video = ObjectMapper.Map<RVideoEntity>(item);
                    //        video.RWorkStepEntityId = workStep.Id;
                    //        video.Id = Guid.NewGuid();
                    //        rVideos.Add(video);
                    //    }
                    //    if (rVideos.Count > 0)
                    //    {
                    //        await _videoEntityRepository.GetDbContext().BulkInsertAsync(rVideos);
                    //    }
                    //    //foreach (var item in workStepDto.Video)
                    //    //{
                    //    //    var video = ObjectMapper.Map<RVideoEntity>(item);
                    //    //    video.RWorkStepEntityId = workStep.Id;
                    //    //    video.Id = Guid.NewGuid();
                    //    //    await _videoEntityRepository.InsertAsync(video);
                    //    //}
                    //}

                    try
                    {
                        if (workStepDto.MainParts != null && workStepDto.MainParts.Count > 0)
                        {
                            foreach (var item in workStepDto.MainParts)
                            {
                                var record = new R具有证明书的主要零件记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.SecondDrawingNum, item.Certificate, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.Remarks);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _mainPartsRepository.InsertAsync(record);
                            }
                        }
                        if (workStepDto.MultimediaRecord != null && workStepDto.MultimediaRecord.Count > 0)
                        {
                            foreach (var item in workStepDto.MultimediaRecord)
                            {
                                var record = new R通用多媒体记录表(item.SerialNum, item.Sort, workStep.Id, proDto.Id, item.FisrtDrawingNum, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordRequire);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData));
                                record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
                                await _multiMediaRepository.InsertAsync(record);
                            }
                        }
                        if (workStepDto.Moment != null && workStepDto.Moment.Count > 0)
                        {
                            foreach (var item in workStepDto.Moment)
                            {
                                var record = new R力矩记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.SecondDrawingNum, item.ToolUsed, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand, item.ProcessorDemand, item.Remarks);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _momentRepository.InsertAsync(record);
                            }
                        }
                        if (workStepDto.TorqueReCalibration != null && workStepDto.TorqueReCalibration.Count > 0)
                        {
                            foreach (var item in workStepDto.TorqueReCalibration)
                            {
                                var record = new R通用力矩复校记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.SecondDrawingNum, item.ToolUsed, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.ProcessorDemand, item.Remarks);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _momentRecordRepository.InsertAsync(record);
                            }
                        }
                        if (workStepDto.GeneralRecords != null && workStepDto.GeneralRecords.Count > 0)
                        {
                            foreach (var item in workStepDto.GeneralRecords)
                            {
                                var record = new R通用记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.RecordElement, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.FirstConfirmResult);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _generalRecordsRepository.InsertAsync(record);
                            }
                        }
                        if (workStepDto.QualityControl != null && workStepDto.QualityControl.Count > 0)
                        {
                            foreach (var item in workStepDto.QualityControl)
                            {
                                var record = new R质量控制记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordRemark);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _controlrecordRepository.InsertAsync(record);
                            }
                        }
                        if (workStepDto.Assemble != null && workStepDto.Assemble.Count > 0)
                        {
                            foreach (var item in workStepDto.Assemble)
                            {
                                var record = new R通用总装数据记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FirstDrawingName, item.RecordElement, item.ToolUsed, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand, item.ProcessorDemand, item.Remarks);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _totalDataRepository.InsertAsync(record);
                            }
                        }
                        if (workStepDto.Hatch != null && workStepDto.Hatch.Count > 0)
                        {
                            foreach (var item in workStepDto.Hatch)
                            {
                                var record = new R舱口盖开闭记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.ProductNum, item.RecordItem, item.ToolUsed, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _hatchRepository.InsertAsync(record);
                            }
                        }
                        if (workStepDto.GlueSolution != null && workStepDto.GlueSolution.Count > 0)
                        {
                            foreach (var item in workStepDto.GlueSolution)
                            {
                                var record = new R胶液配比情况记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.FirstDrawingName, item.RecordRemark);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.MeasuredActual);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _liquidRatioRepository.InsertAsync(record);
                            }
                        }
                        if (workStepDto.InCabin != null && workStepDto.InCabin.Count > 0)
                        {
                            foreach (var item in workStepDto.InCabin)
                            {
                                var record = new R进箱舱登记表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.Model, item.FisrtDrawingNum, item.FirstDrawingName, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordStatus, item.Remarks, item.RecordRequire, item.RecordMainopoint);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData));
                                await _enterRegisterRepository.InsertAsync(record);
                            }
                        }
                        if (workStepDto.CablePlugWaterFireProofControl != null && workStepDto.CablePlugWaterFireProofControl.Count > 0)
                        {
                            foreach (var item in workStepDto.CablePlugWaterFireProofControl)
                            {
                                var record = new R电缆插头防水防热记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.SecondDrawingNum, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.Remarks);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _cableRepository.InsertAsync(record);
                            }
                        }
                        if (workStepDto.BellowsDeformation != null && workStepDto.BellowsDeformation.Count > 0)
                        {
                            foreach (var item in workStepDto.BellowsDeformation)
                            {
                                var record = new R波纹管变形记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ProductNum, item.RecordElement, item.ToolUsed, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.DesignerDemand, item.Remarks);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.ThirdMeasuredValues);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _rippleRepository.InsertAsync(record);
                            }
                        }
                        if (workStepDto.ElectricalConnectInsertion != null && workStepDto.ElectricalConnectInsertion.Count > 0)
                        {
                            foreach (var item in workStepDto.ElectricalConnectInsertion)
                            {
                                var record = new R电连接器插接记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo, item.SecondPhotoNo, item.ThirdPhotoNo, item.FourthPhotoNo);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData), item.FourthOperator, GetDateByString(item.FourthOperatorData));
                                await _connectorRepository.InsertAsync(record);
                            }
                        }
                        //R箭地接口保护件检查记录表 三检
                        if (workStepDto.ArrowInterfaceProtectCheck != null && workStepDto.ArrowInterfaceProtectCheck.Count > 0)
                        {
                            foreach (var item in workStepDto.ArrowInterfaceProtectCheck)
                            {
                                var record = new R箭地接口保护件检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordMainopoint, item.RecordRequire);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _arrowInterfaceProtectCheckRepository.InsertAsync(record);
                            }
                        }
                        //绝热去除记录表
                        if (workStepDto.AdiabaticRemoval != null && workStepDto.AdiabaticRemoval.Count > 0)
                        {
                            foreach (var item in workStepDto.AdiabaticRemoval)
                            {
                                var record = new R绝热去除记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductName, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire);
                                record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _adiabaticRemovalRepository.InsertAsync(record);
                            }
                        }
                        //R箭体称重时多装少装产品记录表
                        if (workStepDto.ArrowScalageProducts != null && workStepDto.ArrowScalageProducts.Count > 0)
                        {
                            foreach (var item in workStepDto.ArrowScalageProducts)
                            {
                                var record = new R箭体称重时多装少装产品记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.RecordRemark);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.FirstConfirmResult);

                                await _arrowScalageProductsRepository.InsertAsync(record);
                            }
                        }
                        //舱口盖开闭测试记录表
                        if (workStepDto.HatchOpenShutTest != null && workStepDto.HatchOpenShutTest.Count > 0)
                        {
                            foreach (var item in workStepDto.HatchOpenShutTest)
                            {
                                var record = new R舱口盖开闭测试记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductName, item.FirstDrawingName, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.Remarks);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _hatchOpenShutTestRepository.InsertAsync(record);
                            }
                        }
                        //产品接地状态检查记录表 有温湿度
                        if (workStepDto.ProductGroundingStatus != null && workStepDto.ProductGroundingStatus.Count > 0)
                        {
                            foreach (var item in workStepDto.ProductGroundingStatus)
                            {
                                var record = new R产品接地状态检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.ProductNum, item.ToolUsed, item.RecordRemark);

                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.FirstConfirmResult);
                                record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _productGroundingStatusRepository.InsertAsync(record);
                            }
                        }
                        //强制检验点记录表  有5检 多媒体
                        if (workStepDto.ForcedCheckpoint != null && workStepDto.ForcedCheckpoint.Count > 0)
                        {
                            foreach (var item in workStepDto.ForcedCheckpoint)
                            {
                                var record = new R强制检验点记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.FirstConfirmResult);
                                record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData), item.FourthOperator, GetDateByString(item.FourthOperatorData), item.FifthOperator, GetDateByString(item.FifthOperatorData));
                                await _forcedCheckpointRepository.InsertAsync(record);
                            }
                        }
                        //自动关闭口盖检查记录表
                        if (workStepDto.AutomaticShutoff != null && workStepDto.AutomaticShutoff.Count > 0)
                        {
                            foreach (var item in workStepDto.AutomaticShutoff)
                            {
                                var record = new R自动关闭口盖检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.RecordItem, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _automaticShutoffRepository.InsertAsync(record);
                            }
                        }
                        //状态检查表
                        if (workStepDto.StatusCheck != null && workStepDto.StatusCheck.Count > 0)
                        {
                            foreach (var item in workStepDto.StatusCheck)
                            {
                                var record = new R状态检查表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData));
                                await _statusCheckRepository.InsertAsync(record);
                            }
                        }
                        //问题记录表
                        if (workStepDto.ProblemRecord != null && workStepDto.ProblemRecord.Count > 0)
                        {
                            foreach (var item in workStepDto.ProblemRecord)
                            {
                                var record = new R问题记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FirstDrawingName, item.RecordElement, item.AbnormalRecord, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.Remarks);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.MeasuredActual);
                                record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                await _problemRecordRepository.InsertAsync(record);
                            }
                        }
                        //爆索尺寸测量记录表 _detonatingCableSizeRepository
                        if (workStepDto.DetonatingCableSize != null && workStepDto.DetonatingCableSize.Count > 0)
                        {
                            foreach (var item in workStepDto.DetonatingCableSize)
                            {
                                var record = new R爆索尺寸测量记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ToolUsed, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.ThirdMeasuredValues);
                                record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
                                await _detonatingCableSizeRepository.InsertAsync(record);
                            }
                        }
                        //整流罩星箭分离弹簧压缩数据记录表
                        if (workStepDto.ReleaseSpringCompression != null && workStepDto.ReleaseSpringCompression.Count > 0)
                        {
                            foreach (var item in workStepDto.ReleaseSpringCompression)
                            {
                                var record = new R整流罩星箭分离弹簧压缩数据记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductName, item.ProductNum, item.ToolUsed, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.ThirdMeasuredValues, item.FourthMeasuredValues);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _releaseSpringCompressionRepository.InsertAsync(record);
                            }
                        }
                        //载荷支架组合体形位数据记录表
                        if (workStepDto.LoadBracket != null && workStepDto.LoadBracket.Count > 0)
                        {
                            foreach (var item in workStepDto.LoadBracket)
                            {
                                var record = new R载荷支架组合体形位数据记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordItem, item.ToolUsed, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _loadBracketRepository.InsertAsync(record);
                            }
                        }
                        //设计签署总装数据记录表
                        if (workStepDto.DesignGeneralAssemble != null && workStepDto.DesignGeneralAssemble.Count > 0)
                        {
                            foreach (var item in workStepDto.DesignGeneralAssemble)
                            {
                                var record = new R设计签署总装数据记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FirstDrawingName, item.RecordElement, item.ToolUsed, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand, item.ProcessorDemand, item.Remarks);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData), item.FourthOperator, GetDateByString(item.FourthOperatorData));
                                await _designGeneralAssembleRepository.InsertAsync(record);
                            }
                        }
                        //管路活门气密点检查记录表皂泡法
                        if (workStepDto.SoapBubble != null && workStepDto.SoapBubble.Count > 0)
                        {
                            foreach (var item in workStepDto.SoapBubble)
                            {
                                var record = new R管路活门气密点检查记录表皂泡法(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductNum, item.FisrtDrawingNum, item.SecondDrawingNum, item.RecordElement, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire, item.DesignerDemand, item.ProcessorDemand, item.Remarks);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);

                                await _soapBubbleRepository.InsertAsync(record);
                            }
                        }
                        //管路活门气密点检查记录表氦质谱法
                        if (workStepDto.HeliumMassSpectrometry != null && workStepDto.HeliumMassSpectrometry.Count > 0)
                        {
                            foreach (var item in workStepDto.HeliumMassSpectrometry)
                            {
                                var record = new R管路活门气密点检查记录表氦质谱法(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductNum, item.FisrtDrawingNum, item.SecondDrawingNum, item.RecordElement, item.ToolUsed, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire, item.DesignerDemand, item.ProcessorDemand, item.Remarks);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.ThirdMeasuredValues, item.FourthMeasuredValues);
                                record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity, item.AtmPressure);
                                await _heliumMassSpectrometryRepository.InsertAsync(record);
                            }
                        }
                        //除了打保险防松外的总装直属件记录表
                        if (workStepDto.FinalAssemblyParts != null && workStepDto.FinalAssemblyParts.Count > 0)
                        {
                            foreach (var item in workStepDto.FinalAssemblyParts)
                            {
                                var record = new R除了打保险防松外的总装直属件记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductName, item.FisrtDrawingNum, item.SecondDrawingNum, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordMainopoint, item.DesignerDemand);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.MeasuredActual);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _finalAssemblyPartsRepository.InsertAsync(record);
                            }
                        }
                        //传感器安装测试记录情况统计记录表
                        if (workStepDto.SensorInstallation != null && workStepDto.SensorInstallation.Count > 0)
                        {
                            foreach (var item in workStepDto.SensorInstallation)
                            {
                                var record = new R传感器安装测试记录情况统计记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductNum, item.ParentProductName, item.FisrtDrawingNum, item.FirstDrawingName, item.RecordElement, item.RecordItem, item.ToolUsed, item.SecondToolUsed, item.ThirdToolUsed, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordStatus, item.RecordRequire, item.RecordMainopoint, item.DesignerDemand, item.ProcessorDemand);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues);
                                record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _sensorInstallationRepository.InsertAsync(record);
                            }
                        }
                        //插头状态检查表
                        if (workStepDto.PlugStatus != null && workStepDto.PlugStatus.Count > 0)
                        {
                            foreach (var item in workStepDto.PlugStatus)
                            {
                                var record = new R插头状态检查表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordStatus, item.RecordRequire, item.Remarks);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
                                record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _plugStatusRepository.InsertAsync(record);
                            }
                        }
                        //惯组安装记录表1
                        if (workStepDto.FirstIMUInstallation != null && workStepDto.FirstIMUInstallation.Count > 0)
                        {
                            foreach (var item in workStepDto.FirstIMUInstallation)
                            {
                                var record = new R惯组安装记录表一(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ToolUsed, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _firstIMUInstallationRepository.InsertAsync(record);
                            }
                        }
                        //惯组安装记录表2
                        if (workStepDto.SecondIMUInstallation != null && workStepDto.SecondIMUInstallation.Count > 0)
                        {
                            foreach (var item in workStepDto.SecondIMUInstallation)
                            {
                                var record = new R惯组安装记录表二(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ToolUsed, item.RecordItem, item.RecordRemark);

                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _secondIMUInstallationRepository.InsertAsync(record);
                            }
                        }
                        //电缆高度测量记录表
                        if (workStepDto.CableHeight != null && workStepDto.CableHeight.Count > 0)
                        {
                            foreach (var item in workStepDto.CableHeight)
                            {
                                var record = new R电缆高度测量记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ToolUsed, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _cableHeightRepository.InsertAsync(record);
                            }
                        }
                        //电缆剥线试验记录表低频
                        if (workStepDto.LowFrequencyCableStripping != null && workStepDto.LowFrequencyCableStripping.Count > 0)
                        {
                            foreach (var item in workStepDto.LowFrequencyCableStripping)
                            {
                                var record = new R电缆剥线试验记录表低频(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ToolUsed, item.SecondToolUsed, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.FirstConfirmResult);
                                record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _lowFrequencyCableStrippingRepository.InsertAsync(record);
                            }
                        }
                        //压接实验测量记录表低频
                        if (workStepDto.LowCrimpingExperiment != null && workStepDto.LowCrimpingExperiment.Count > 0)
                        {
                            foreach (var item in workStepDto.LowCrimpingExperiment)
                            {
                                var record = new R压接实验测量记录表低频(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ToolUsed, item.RecordItem, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);

                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _lowCrimpingExperimentRepository.InsertAsync(record);
                            }
                        }
                        //电缆剥线试验记录表高频
                        if (workStepDto.HighFrequencyCableStripping != null && workStepDto.HighFrequencyCableStripping.Count > 0)
                        {
                            foreach (var item in workStepDto.HighFrequencyCableStripping)
                            {
                                var record = new R电缆剥线试验记录表高频(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ToolUsed, item.SecondToolUsed, item.RecordItem, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.SecondMeasuredValues, item.FirstConfirmResult);
                                record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData));
                                await _highFrequencyCableStrippingRepository.InsertAsync(record);
                            }
                        }
                        //仪器接收检查记录表
                        if (workStepDto.InstrumentCheck != null && workStepDto.InstrumentCheck.Count > 0)
                        {
                            foreach (var item in workStepDto.InstrumentCheck)
                            {
                                var record = new R仪器接收检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.FirstConfirmResult, item.SecondConfirmResult, item.ThirdConfirmResult);

                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));

                                await _instrumentCheckRepository.InsertAsync(record);
                            }
                        }
                        //电缆接收检查记录表
                        if (workStepDto.CableReceivingInspection != null && workStepDto.CableReceivingInspection.Count > 0)
                        {
                            foreach (var item in workStepDto.CableReceivingInspection)
                            {
                                var record = new R电缆接收检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult, item.SecondConfirmResult, item.ThirdConfirmResult);

                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));

                                await _cableReceivingInspectionRepository.InsertAsync(record);
                            }
                        }
                        //通用检查记录表
                        if (workStepDto.InspectionRecord != null && workStepDto.InspectionRecord.Count > 0)
                        {
                            foreach (var item in workStepDto.InspectionRecord)
                            {
                                var record = new R通用检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductName, item.RecordItem, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);

                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));

                                await _inspectionRecordRepository.InsertAsync(record);
                            }
                        }
                        //对接面形位记录表
                        if (workStepDto.DockSurfaceMorpheme != null && workStepDto.DockSurfaceMorpheme.Count > 0)
                        {
                            foreach (var item in workStepDto.DockSurfaceMorpheme)
                            {
                                var record = new R对接面形位记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductName, item.ParentProductName, item.ToolUsed, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);

                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
                                await _dockSurfaceMorphemeRepository.InsertAsync(record);
                            }
                        }
                        //整流罩锉修记录表
                        if (workStepDto.FilingFileRepair != null && workStepDto.FilingFileRepair.Count > 0)
                        {
                            foreach (var item in workStepDto.FilingFileRepair)
                            {
                                var record = new R整流罩锉修记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);

                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.MeasuredActual);

                                await _filingFileRepairRepository.InsertAsync(record);
                            }
                        }
                        //整流罩安装后检查记录表
                        if (workStepDto.CheckFairingAfterInstallation != null && workStepDto.CheckFairingAfterInstallation.Count > 0)
                        {
                            foreach (var item in workStepDto.CheckFairingAfterInstallation)
                            {
                                var record = new R整流罩安装后检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FirstDrawingName, item.RecordRemark);

                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.MeasuredActual, item.FirstConfirmResult);

                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));

                                await _checkFairingAfterInstallationRepository.InsertAsync(record);
                            }
                        }
                        //导管检查记录表
                        if (workStepDto.Catheterization != null && workStepDto.Catheterization.Count > 0)
                        {
                            foreach (var item in workStepDto.Catheterization)
                            {
                                var record = new R导管检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);

                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.MeasuredActual);
                                record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData), item.FourthOperator, GetDateByString(item.FourthOperatorData));
                                await _catheterizationRepository.InsertAsync(record);
                            }
                        }
                        //管路上箭前吹除记录表
                        if (workStepDto.BlowPipeArrow != null && workStepDto.BlowPipeArrow.Count > 0)
                        {
                            foreach (var item in workStepDto.BlowPipeArrow)
                            {
                                var record = new R管路上箭前吹除记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);

                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.FirstConfirmResult);
                                record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _blowPipeArrowRepository.InsertAsync(record);
                            }
                        }
                        //气封管流量测试记录表
                        if (workStepDto.GasPipeTest != null && workStepDto.GasPipeTest.Count > 0)
                        {
                            foreach (var item in workStepDto.GasPipeTest)
                            {
                                var record = new R气封管流量测试记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ToolUsed, item.FisrtDrawingNum, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.ProcessorDemand, item.RecordRequire);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.ThirdMeasuredValues, item.FourthMeasuredValues);
                                record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _gasPipeTestRepository.InsertAsync(record);
                            }
                        }
                        //阀门气瓶过滤器流量计输送管金属软管等检查记录表
                        if (workStepDto.ValvesGasInspection != null && workStepDto.ValvesGasInspection.Count > 0)
                        {
                            foreach (var item in workStepDto.ValvesGasInspection)
                            {
                                var record = new R阀门气瓶过滤器流量计输送管金属软管等检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.ProductNum, item.RecordElement, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordStatus);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
                                record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _valvesGasInspectionRepository.InsertAsync(record);
                            }
                        }
                        //单机安装位置记录表
                        if (workStepDto.InstallationLocation != null && workStepDto.InstallationLocation.Count > 0)
                        {
                            foreach (var item in workStepDto.InstallationLocation)
                            {
                                var record = new R单机安装位置记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ProductNum, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);

                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _installationLocationRepository.InsertAsync(record);
                            }
                        }
                        //安装距离记录表
                        if (workStepDto.InstallationDistance != null && workStepDto.InstallationDistance.Count > 0)
                        {
                            foreach (var item in workStepDto.InstallationDistance)
                            {
                                var record = new R安装距离记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordElement, item.ToolUsed, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordRequire);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);

                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _installationDistanceRepository.InsertAsync(record);
                            }
                        }
                        //小导管卡箍间距测量表
                        if (workStepDto.MeasurementSpacingConduit != null && workStepDto.MeasurementSpacingConduit.Count > 0)
                        {
                            foreach (var item in workStepDto.MeasurementSpacingConduit)
                            {
                                var record = new R小导管卡箍间距测量表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ToolUsed, item.FisrtDrawingNum, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordMainopoint);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _measurementSpacingConduitRepository.InsertAsync(record);
                            }
                        }
                        //未按要求施加力矩及未打保险防松记录表
                        if (workStepDto.FailureAequiredLoosInsurance != null && workStepDto.FailureAequiredLoosInsurance.Count > 0)
                        {
                            foreach (var item in workStepDto.FailureAequiredLoosInsurance)
                            {
                                var record = new R未按要求施加力矩及未打保险防松记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordMainopoint, item.ProcessorDemand);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.MeasuredActual);

                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _failureAequiredLoosInsuranceRepository.InsertAsync(record);
                            }
                        }
                        //分解重装记录表
                        if (workStepDto.DisassemblyReassembly != null && workStepDto.DisassemblyReassembly.Count > 0)
                        {
                            foreach (var item in workStepDto.DisassemblyReassembly)
                            {
                                var record = new R分解重装记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordMainopoint, item.RecordRequire);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.MeasuredActual);

                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _disassemblyReassemblyRepository.InsertAsync(record);
                            }
                        }
                        //配合七零三绝热记录表
                        if (workStepDto.Insulation703 != null && workStepDto.Insulation703.Count > 0)
                        {
                            foreach (var item in workStepDto.Insulation703)
                            {
                                var record = new R配合七零三绝热记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FirstDrawingName, item.ParentProductName, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordMainopoint);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);

                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _insulation703Repository.InsertAsync(record);
                            }
                        }
                        //连续拧紧环节力矩复校记录表
                        if (workStepDto.CalibrationContinuousTorque != null && workStepDto.CalibrationContinuousTorque.Count > 0)
                        {
                            foreach (var item in workStepDto.CalibrationContinuousTorque)
                            {
                                var record = new R连续拧紧环节力矩复校记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.SecondDrawingNum, item.ToolUsed, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.DesignerDemand, item.ProcessorDemand);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues);

                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _calibrationContinuousTorqueRepository.InsertAsync(record);
                            }
                        }
                        //管路垫块安装情况记录表
                        if (workStepDto.InstallationPipeCushion != null && workStepDto.InstallationPipeCushion.Count > 0)

                        {
                            foreach (var item in workStepDto.InstallationPipeCushion)
                            {
                                var record = new R管路垫块安装情况记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordMainopoint);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.MeasuredActual);

                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _installationPipeCushionRepository.InsertAsync(record);
                            }
                        }
                        //箭体结构防水记录表
                        if (workStepDto.ArrowStructureWaterproof != null && workStepDto.ArrowStructureWaterproof.Count > 0)

                        {
                            foreach (var item in workStepDto.ArrowStructureWaterproof)
                            {
                                var record = new R箭体结构防水记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ParentProductName, item.RecordElement, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand, item.Remarks);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);

                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _arrowStructureWaterproofRepository.InsertAsync(record);
                            }
                        }
                        //搭接线安装部位防水记录表
                        if (workStepDto.WaterproofInstallationLapd != null && workStepDto.WaterproofInstallationLapd.Count > 0)

                        {
                            foreach (var item in workStepDto.WaterproofInstallationLapd)
                            {
                                var record = new R搭接线安装部位防水记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductName, item.RecordElement, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand, item.Remarks);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.FirstConfirmResult);

                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _waterproofInstallationLapdRepository.InsertAsync(record);
                            }
                        }
                        //总装零件称重记录表
                        if (workStepDto.Assemnleweighing != null && workStepDto.Assemnleweighing.Count > 0)

                        {
                            foreach (var item in workStepDto.Assemnleweighing)
                            {
                                var record = new R总装零件称重记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.ToolUsed, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues);

                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _assemnleweighingRepository.InsertAsync(record);
                            }
                        }
                        //箭体称重记录表 ArrowWeight
                        if (workStepDto.ArrowWeight != null && workStepDto.ArrowWeight.Count > 0)

                        {
                            foreach (var item in workStepDto.ArrowWeight)
                            {
                                var record = new R箭体称重记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductName, item.RecordElement, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire, item.RecordStatus);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _arrowWeightRepository.InsertAsync(record);
                            }
                        }
                        //总装耗材称重记录表
                        if (workStepDto.GeneralWeighing != null && workStepDto.GeneralWeighing.Count > 0)

                        {
                            foreach (var item in workStepDto.GeneralWeighing)
                            {
                                var record = new R总装耗材称重记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.ToolUsed, item.RecordRemark);

                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.ThirdMeasuredValues, item.FourthMeasuredValues);

                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _generalWeighingRepository.InsertAsync(record);
                            }
                        }
                        //飞行质量质心设备调平数据记录表
                        if (workStepDto.LevelingDataFlight != null && workStepDto.LevelingDataFlight.Count > 0)

                        {
                            foreach (var item in workStepDto.LevelingDataFlight)
                            {
                                var record = new R飞行质量质心设备调平数据记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);


                                await _levelingDataFlightRepository.InsertAsync(record);
                            }
                        }
                        //飞行质量质心皮重及参数记录表
                        if (workStepDto.FlightMassCentroidTareWeight != null && workStepDto.FlightMassCentroidTareWeight.Count > 0)

                        {
                            foreach (var item in workStepDto.FlightMassCentroidTareWeight)
                            {
                                var record = new R飞行质量质心皮重及参数记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.RecordItem, item.RecordRemark);

                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);


                                await _flightMassCentroidTareWeightRepository.InsertAsync(record);
                            }
                        }
                        //横向质心测量记录表
                        if (workStepDto.TransverseCentroid != null && workStepDto.TransverseCentroid.Count > 0)

                        {
                            foreach (var item in workStepDto.TransverseCentroid)
                            {
                                var record = new R横向质心测量记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.ThirdMeasuredValues, item.FourthMeasuredValues);


                                await _transverseCentroidRepository.InsertAsync(record);
                            }
                        }
                        //大部段称重记录表
                        if (workStepDto.LargeSectionWeight != null && workStepDto.LargeSectionWeight.Count > 0)

                        {
                            foreach (var item in workStepDto.LargeSectionWeight)
                            {
                                var record = new R大部段称重记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ToolUsed, item.RecordElement, item.RecordRemark);

                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);

                                await _largeSectionWeightRepository.InsertAsync(record);
                            }
                        }
                        // 产品安装确认表
                        if (workStepDto.ProductInstallationConfirmation != null && workStepDto.ProductInstallationConfirmation.Count > 0)

                        {
                            foreach (var item in workStepDto.ProductInstallationConfirmation)
                            {
                                var record = new R产品安装确认表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.ProcessorDemand, item.Remarks);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.MeasuredActual);


                                await _productInstallationConfirmationRepository.InsertAsync(record);
                            }
                        }
                        //阀门安装状态确认表
                        if (workStepDto.ConfirmationStatus != null && workStepDto.ConfirmationStatus.Count > 0)

                        {
                            foreach (var item in workStepDto.ConfirmationStatus)
                            {
                                var record = new R阀门安装状态确认表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.FisrtDrawingNum, item.FirstDrawingName, item.ProductNum, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.Remarks);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);


                                await _confirmationStatusRepository.InsertAsync(record);
                            }
                        }
                        //接收检查记录表
                        if (workStepDto.ReceivingInspectionRecord != null && workStepDto.ReceivingInspectionRecord.Count > 0)

                        {
                            foreach (var item in workStepDto.ReceivingInspectionRecord)
                            {
                                var record = new R通用接收检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire);
                                record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.MeasuredActual);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));

                                await _receivingInspectionRecordRepository.InsertAsync(record);
                            }
                        }
                        //通用保护件检查记录表
                        if (workStepDto.ProtectiveParts != null && workStepDto.ProtectiveParts.Count > 0)

                        {
                            foreach (var item in workStepDto.ProtectiveParts)
                            {
                                var record = new R通用保护件检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FirstDrawingName, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordStatus, item.RecordRequire);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult, item.MeasuredActual);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));

                                await _protectivePartsRepository.InsertAsync(record);
                            }
                        }
                        //接口检查记录表
                        if (workStepDto.InterfaceCheck != null && workStepDto.InterfaceCheck.Count > 0)

                        {
                            foreach (var item in workStepDto.InterfaceCheck)
                            {
                                var record = new R接口检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult, item.MeasuredActual);
                                record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));

                                await _interfaceCheckRepository.InsertAsync(record);
                            }
                        }
                        //象限标识检查记录表
                        if (workStepDto.QuadrantCheck != null && workStepDto.QuadrantCheck.Count > 0)

                        {
                            foreach (var item in workStepDto.QuadrantCheck)
                            {
                                var record = new R象限标识检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordRequire, item.Remarks);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.FirstConfirmResult);
                                await _quadrantCheckRepository.InsertAsync(record);
                            }
                        }
                        //干燥剂检查记录表
                        if (workStepDto.DesiccantInspection != null && workStepDto.DesiccantInspection.Count > 0)

                        {
                            foreach (var item in workStepDto.DesiccantInspection)
                            {
                                var record = new R干燥剂检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.Remarks);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.MeasuredActual);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _desiccantInspectionRepository.InsertAsync(record);
                            }
                        }
                        //随大部段交付产品明细表
                        if (workStepDto.LargePartsDelivery != null && workStepDto.LargePartsDelivery.Count > 0)

                        {
                            foreach (var item in workStepDto.LargePartsDelivery)
                            {
                                var record = new R随大部段交付产品明细表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand, item.Remarks);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);

                                await _largePartsDeliveryRepository.InsertAsync(record);
                            }
                        }
                        //气瓶组充放气速率记录表
                        if (workStepDto.CylinderGroup != null && workStepDto.CylinderGroup.Count > 0)

                        {
                            foreach (var item in workStepDto.CylinderGroup)
                            {
                                var record = new R气瓶组充放气速率记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ToolUsed, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.ThirdMeasuredValues, item.FourthMeasuredValues);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _cylinderGroupRepository.InsertAsync(record);
                            }
                        }
                        //系统保压记录表
                        if (workStepDto.SystemPressureMaintaining != null && workStepDto.SystemPressureMaintaining.Count > 0)

                        {
                            foreach (var item in workStepDto.SystemPressureMaintaining)
                            {
                                var record = new R系统保压记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FirstDrawingName, item.ToolUsed, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordStatus, item.DesignerDemand, item.RecordRequire);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues);
                                record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
                                await _systemPressureMaintainingRepository.InsertAsync(record);
                            }
                        }
                        //气瓶压力测试记录表
                        if (workStepDto.CylinderPressureTest != null && workStepDto.CylinderPressureTest.Count > 0)

                        {
                            foreach (var item in workStepDto.CylinderPressureTest)
                            {
                                var record = new R气瓶压力测试记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FirstDrawingName, item.ToolUsed, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand, item.Remarks);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);

                                await _cylinderPressureTestRepository.InsertAsync(record);
                            }
                        }
                        //阀门使用次数记录表
                        if (workStepDto.ValveUsageTimes != null && workStepDto.ValveUsageTimes.Count > 0)

                        {
                            foreach (var item in workStepDto.ValveUsageTimes)
                            {
                                var record = new R阀门使用次数记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ProductNum, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand, item.RecordStatus);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _valveUsageTimesRepository.InsertAsync(record);
                            }
                        }
                        //阀门测试记录表
                        if (workStepDto.ValveTest != null && workStepDto.ValveTest.Count > 0)

                        {
                            foreach (var item in workStepDto.ValveTest)
                            {
                                var record = new R阀门测试记录表一(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ProductNum, item.FirstDrawingName, item.RecordElement, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire, item.RecordStatus, item.Remarks);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _valveTestRepository.InsertAsync(record);
                            }
                        }
                        //气封流量测试记录表
                        if (workStepDto.GasSealFlowTest != null && workStepDto.GasSealFlowTest.Count > 0)

                        {
                            foreach (var item in workStepDto.GasSealFlowTest)
                            {
                                var record = new R气封流量测试记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FirstDrawingName, item.ToolUsed, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.ThirdMeasuredValues);
                                record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _gasSealFlowTestRepository.InsertAsync(record);
                            }
                        }
                        //阀门测试记录表2
                        if (workStepDto.ValveTestSec != null && workStepDto.ValveTestSec.Count > 0)

                        {
                            foreach (var item in workStepDto.ValveTestSec)
                            {
                                var record = new R阀门测试记录表二(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ProductNum, item.FirstDrawingName, item.RecordElement, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire, item.RecordStatus, item.Remarks);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues);
                                record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _valveTestSecRepository.InsertAsync(record);
                            }
                        }
                        //电磁阀尾罩检查表
                        if (workStepDto.TailCoverSolenoid != null && workStepDto.TailCoverSolenoid.Count > 0)

                        {
                            foreach (var item in workStepDto.TailCoverSolenoid)
                            {
                                var record = new R电磁阀尾罩检查表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordRequire, item.Remarks);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _tailCoverSolenoidRepository.InsertAsync(record);
                            }
                        }
                        //传感器变换器对应关系确认记录表
                        if (workStepDto.CorrespondingRelationship != null && workStepDto.CorrespondingRelationship.Count > 0)

                        {
                            foreach (var item in workStepDto.CorrespondingRelationship)
                            {
                                var record = new R传感器变换器对应关系确认记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ParentProductNum, item.ParentProductName, item.SecondDrawingNum, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordRequire, item.RecordStatus, item.RecordMainopoint);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _correspondingRelationshipRepository.InsertAsync(record);
                            }
                        }
                        //产品安装数量记录表
                        if (workStepDto.InstallationQuantity != null && workStepDto.InstallationQuantity.Count > 0)

                        {
                            foreach (var item in workStepDto.InstallationQuantity)
                            {
                                var record = new R产品安装数量记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.RecordRemark);

                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _installationQuantityRepository.InsertAsync(record);
                            }
                        }
                        //液位传感器尺寸协调记录表
                        if (workStepDto.LiquidLevelSensor != null && workStepDto.LiquidLevelSensor.Count > 0)

                        {
                            foreach (var item in workStepDto.LiquidLevelSensor)
                            {
                                var record = new R液位传感器尺寸协调记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.ToolUsed, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues);
                                record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _liquidLevelSensorRepository.InsertAsync(record);
                            }
                        }
                        //密封插头压接多媒体记录表
                        if (workStepDto.CrimpingSealedPlug != null && workStepDto.CrimpingSealedPlug.Count > 0)

                        {
                            foreach (var item in workStepDto.CrimpingSealedPlug)
                            {
                                var record = new R密封插头压接多媒体记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ParentProductNum, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordMainopoint, item.Remarks);
                                record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData), item.FourthOperator, GetDateByString(item.FourthOperatorData));
                                await _crimpingSealedPlugRepository.InsertAsync(record);
                            }
                        }
                        //岗位分工表
                        if (workStepDto.JobDivision != null && workStepDto.JobDivision.Count > 0)

                        {
                            foreach (var item in workStepDto.JobDivision)
                            {
                                var record = new R岗位分工表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordRemark);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.MeasuredActual);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData), item.FourthOperator, GetDateByString(item.FourthOperatorData));
                                await _jobDivisionRepository.InsertAsync(record);
                            }
                        }
                        //低频压接实验测量记录表
                        if (workStepDto.ExperimentalCrimping != null && workStepDto.ExperimentalCrimping.Count > 0)

                        {
                            foreach (var item in workStepDto.ExperimentalCrimping)
                            {
                                var record = new R低频压接实验测量记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ToolUsed, item.SecondToolUsed, item.ThirdToolUsed, item.RecordItem, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordRequire, item.RecordStatus, item.RecordMainopoint);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.ThirdMeasuredValues);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _experimentalCrimpingRepository.InsertAsync(record);
                            }
                        }
                        //高频压接点电阻及抗电强度检查记录表
                        if (workStepDto.HighFrequencyVoltage != null && workStepDto.HighFrequencyVoltage.Count > 0)

                        {
                            foreach (var item in workStepDto.HighFrequencyVoltage)
                            {
                                var record = new R高频压接点电阻及抗电强度检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ToolUsed, item.SecondToolUsed, item.ThirdToolUsed, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordRequire, item.RecordStatus, item.RecordMainopoint);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.ThirdMeasuredValues);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _highFrequencyVoltageRepository.InsertAsync(record);
                            }
                        }
                        //高频压接点抗拉强度检查记录表
                        if (workStepDto.TensileStrengthHigh != null && workStepDto.TensileStrengthHigh.Count > 0)

                        {
                            foreach (var item in workStepDto.TensileStrengthHigh)
                            {
                                var record = new R高频压接点抗拉强度检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ToolUsed, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire, item.RecordStatus);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _tensileStrengthHighRepository.InsertAsync(record);
                            }
                        }
                        //电连接器插接多媒体记录表
                        if (workStepDto.MultimediaElectricalConnect != null && workStepDto.MultimediaElectricalConnect.Count > 0)

                        {
                            foreach (var item in workStepDto.MultimediaElectricalConnect)
                            {
                                var record = new R电连接器插接多媒体记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.ProductNum, item.ParamCode, item.RecordRemark);
                                record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo, item.SecondPhotoNo, item.ThirdPhotoNo, item.FourthPhotoNo);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _dianlianjieqichajieduomeitijilubiaoRepository.InsertAsync(record);
                            }
                        }
                        //仪器安装电缆余量多媒体记录表
                        if (workStepDto.InstrumentCableAllowance != null && workStepDto.InstrumentCableAllowance.Count > 0)

                        {
                            foreach (var item in workStepDto.InstrumentCableAllowance)
                            {
                                var record = new R仪器安装电缆余量多媒体记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.ProductNum, item.ParamCode, item.RecordRemark);
                                record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _yiqianzhuangdianlanyuliangduomeitijilubiaoRepository.InsertAsync(record);
                            }
                        }
                        //仪器安装分离钢索多媒体记录表
                        if (workStepDto.InstrumentSeparationCable != null && workStepDto.InstrumentSeparationCable.Count > 0)

                        {
                            foreach (var item in workStepDto.InstrumentSeparationCable)
                            {
                                var record = new R仪器安装分离钢索多媒体记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.ProductNum, item.ParamCode, item.RecordRemark);
                                record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _yiqianzhuangfenligangsuoduomeitijilubiaoRepository.InsertAsync(record);
                            }
                        }
                        //仪器安装分离力测试多媒体记录表
                        if (workStepDto.InstrumentSeparationForceTest != null && workStepDto.InstrumentSeparationForceTest.Count > 0)

                        {
                            foreach (var item in workStepDto.InstrumentSeparationForceTest)
                            {
                                var record = new R仪器安装分离力测试多媒体记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.ProductNum, item.ParamCode, item.RecordRemark);
                                record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _yiqianzhuangfenliceshiduomeitijilubiaoRepository.InsertAsync(record);
                            }
                        }
                        //仪器安装力矩记录表
                        if (workStepDto.InstrumentTorqueRecord != null && workStepDto.InstrumentTorqueRecord.Count > 0)

                        {
                            foreach (var item in workStepDto.InstrumentTorqueRecord)
                            {
                                var record = new R仪器安装力矩记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.ProductNum, item.ParamCode, item.ToolUsed, item.RecordRemark);
                                record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand, item.ProcessorDemand, item.Remarks);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _yiqianzhuanglijvjilubiaoRepository.InsertAsync(record);
                            }
                        }
                        //仪器插座安装多媒体记录表
                        if (workStepDto.MultimediaSheetSocket != null && workStepDto.MultimediaSheetSocket.Count > 0)

                        {
                            foreach (var item in workStepDto.MultimediaSheetSocket)
                            {
                                var record = new R仪器插座安装多媒体记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.ProductNum, item.ParamCode, item.RecordRemark);
                                record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
                                record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
                                record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateByString(item.FirstOperatorData), item.SecondOperator, GetDateByString(item.SecondOperatorData), item.ThirdOperator, GetDateByString(item.ThirdOperatorData));
                                await _yiqichazuoanzhuangduomeitijilubiaoRepository.InsertAsync(record);
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        throw e;// new UserFriendlyException("文件未签署完成！");
                    }
                }
            }
            var techList = _rTechniqueEntityRepository.FirstOrDefault(t => t.Id == technique.Id&&t.IsDeleted ==false);
            if (techList==null)
            {
                var Id = await _rTechniqueRepository.InsertAndGetIdAsync(technique);
                //_unitOfWorkManager.Current.SaveChanges();
                //_rTechniqueRepository.GetDbContext().Entry(techList).State = EntityState.Detached;
                return Id;
            }
            else 
            {
                _rTechniqueRepository.GetDbContext().Entry(techList).State = EntityState.Detached;
                var Id = await _rTechniqueRepository.InsertOrUpdateAndGetIdAsync(technique);
                _unitOfWorkManager.Current.SaveChanges();
               
                return techList.Id;
            }
            
        }
        /// <summary>
        /// 将字符串转换为时间类型 支持null  Edit by DaoBen 2021 10 18
        /// </summary>
        /// <param name="dateStr"></param>
        /// <returns></returns>
        private DateTime? GetDateByString(string dateStr)
        {
            if (string.IsNullOrEmpty(dateStr))
            {
                return null;
            }
            else
            {
                return Convert.ToDateTime(dateStr);
            }

        }




        //private async Task<Guid> InsertAll(TechniqueReturnDto TechniqueEntity, RTechniqueEntity technique)
        //{
        //    foreach (var processesDto in TechniqueEntity.ProcessesListDto)
        //    {
        //        var proDto = ObjectMapper.Map<RProcessesEntity>(processesDto);
        //        proDto.RTechniqueEntityId = technique.Id;
        //        proDto.ProcessesEntityId = processesDto.Id;
        //        proDto.Id = Guid.NewGuid();
        //        proDto.WorkStepEntities = new List<RWorkStepEntity>();
        //        technique.ProcessesEntities.Add(proDto);
        //        foreach (var workStepDto in processesDto.WorkStepListDto)
        //        {
        //            var workStep = ObjectMapper.Map<RWorkStepEntity>(workStepDto);
        //            workStep.RTechniqueEntityId = technique.Id;
        //            workStep.RProcessesEntityId = proDto.Id;
        //            workStep.WorkStepEntityId = workStep.Id;
        //            workStep.Id = Guid.NewGuid();
        //            if (workStepDto.WorkStepUpdateContent!=null)
        //            {
        //                workStep.WorkStepContent = workStepDto.WorkStepUpdateContent;
        //                workStep.WorkStepName = "";
        //            }
        //            proDto.WorkStepEntities.Add(workStep);
        //            if (workStepDto.ManufacturingResources != null && workStepDto.ManufacturingResources.Count > 0)
        //            {
        //                foreach (var item in workStepDto.ManufacturingResources)
        //                {
        //                    var makeResources = ObjectMapper.Map<RMakeResourcesEntity>(item);
        //                    makeResources.RWorkStepEntityId = workStep.Id;
        //                    makeResources.Id = Guid.NewGuid();
        //                    await _makeResourcesEntityRepository.InsertAsync(makeResources);
        //                }
        //            }
        //            if (workStepDto.InsertDetails != null && workStepDto.InsertDetails.Count > 0)
        //            {
        //                foreach (var item in workStepDto.InsertDetails)
        //                {
        //                    var loadPiece = ObjectMapper.Map<RLoadPieceEntity>(item);
        //                    loadPiece.RWorkStepEntityId = workStep.Id;
        //                    loadPiece.Id = Guid.NewGuid();
        //                    await _loadPieceRepository.InsertAsync(loadPiece);
        //                }
        //            }
        //            if (workStepDto.Video != null && workStepDto.Video.Count > 0)
        //            {
        //                foreach (var item in workStepDto.Video)
        //                {
        //                    var video = ObjectMapper.Map<RVideoEntity>(item);
        //                    video.RWorkStepEntityId = workStep.Id;
        //                    video.Id = Guid.NewGuid();
        //                    await _videoEntityRepository.InsertAsync(video);
        //                }
        //            }

        //            try
        //            {
        //                if (workStepDto.MainParts != null && workStepDto.MainParts.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.MainParts)
        //                    {
        //                        var record = new R具有证明书的主要零件记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.SecondDrawingNum, item.Certificate, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.Remarks);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, GetDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _mainPartsRepository.InsertAsync(record);
        //                    }
        //                }
        //                if (workStepDto.MultimediaRecord != null && workStepDto.MultimediaRecord.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.MultimediaRecord)
        //                    {
        //                        var record = new R通用多媒体记录表(item.SerialNum, item.Sort, workStep.Id, proDto.Id, item.FisrtDrawingNum, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordRequire);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData));
        //                        record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
        //                        await _multiMediaRepository.InsertAsync(record);
        //                    }
        //                }
        //                if (workStepDto.Moment != null && workStepDto.Moment.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.Moment)
        //                    {
        //                        var record = new R力矩记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.SecondDrawingNum, item.ToolUsed, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand, item.ProcessorDemand, item.Remarks);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _momentRepository.InsertAsync(record);
        //                    }
        //                }
        //                if (workStepDto.TorqueReCalibration != null && workStepDto.TorqueReCalibration.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.TorqueReCalibration)
        //                    {
        //                        var record = new R通用力矩复校记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.SecondDrawingNum, item.ToolUsed, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.ProcessorDemand, item.Remarks);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _momentRecordRepository.InsertAsync(record);
        //                    }
        //                }
        //                if (workStepDto.GeneralRecords != null && workStepDto.GeneralRecords.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.GeneralRecords)
        //                    {
        //                        var record = new R通用记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.RecordElement, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.FirstConfirmResult);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _generalRecordsRepository.InsertAsync(record);
        //                    }
        //                }
        //                if (workStepDto.QualityControl != null && workStepDto.QualityControl.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.QualityControl)
        //                    {
        //                        var record = new R质量控制记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordRemark);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _controlrecordRepository.InsertAsync(record);
        //                    }
        //                }
        //                if (workStepDto.Assemble != null && workStepDto.Assemble.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.Assemble)
        //                    {
        //                        var record = new R通用总装数据记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FirstDrawingName, item.RecordElement, item.ToolUsed, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand, item.ProcessorDemand, item.Remarks);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
        //                        record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _totalDataRepository.InsertAsync(record);
        //                    }
        //                }
        //                if (workStepDto.Hatch != null && workStepDto.Hatch.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.Hatch)
        //                    {
        //                        var record = new R舱口盖开闭记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.ProductNum, item.RecordItem, item.ToolUsed, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _hatchRepository.InsertAsync(record);
        //                    }
        //                }
        //                if (workStepDto.GlueSolution != null && workStepDto.GlueSolution.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.GlueSolution)
        //                    {
        //                        var record = new R胶液配比情况记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.FirstDrawingName, item.RecordRemark);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.MeasuredActual);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _liquidRatioRepository.InsertAsync(record);
        //                    }
        //                }
        //                if (workStepDto.InCabin != null && workStepDto.InCabin.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.InCabin)
        //                    {
        //                        var record = new R进箱舱登记表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.Model, item.FisrtDrawingNum, item.FirstDrawingName, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordStatus, item.Remarks, item.RecordRequire, item.RecordMainopoint);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData));
        //                        await _enterRegisterRepository.InsertAsync(record);
        //                    }
        //                }
        //                if (workStepDto.CablePlugWaterFireProofControl != null && workStepDto.CablePlugWaterFireProofControl.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.CablePlugWaterFireProofControl)
        //                    {
        //                        var record = new R电缆插头防水防热记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.SecondDrawingNum, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.Remarks);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _cableRepository.InsertAsync(record);
        //                    }
        //                }
        //                if (workStepDto.BellowsDeformation != null && workStepDto.BellowsDeformation.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.BellowsDeformation)
        //                    {
        //                        var record = new R波纹管变形记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ProductNum, item.RecordElement, item.ToolUsed, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.DesignerDemand, item.Remarks);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.ThirdMeasuredValues);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _rippleRepository.InsertAsync(record);
        //                    }
        //                }
        //                if (workStepDto.ElectricalConnectInsertion != null && workStepDto.ElectricalConnectInsertion.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.ElectricalConnectInsertion)
        //                    {
        //                        var record = new R电连接器插接记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
        //                        record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo, item.SecondPhotoNo, item.ThirdPhotoNo, item.FourthPhotoNo);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData), item.FourthOperator, Convert.ToDateTime(item.FourthOperatorData));
        //                        await _connectorRepository.InsertAsync(record);
        //                    }
        //                }
        //                //R箭地接口保护件检查记录表 三检
        //                if (workStepDto.ArrowInterfaceProtectCheck != null && workStepDto.ArrowInterfaceProtectCheck.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.ArrowInterfaceProtectCheck)
        //                    {
        //                        var record = new R箭地接口保护件检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordMainopoint, item.RecordRequire);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _arrowInterfaceProtectCheckRepository.InsertAsync(record);
        //                    }
        //                }
        //                //绝热去除记录表
        //                if (workStepDto.AdiabaticRemoval != null && workStepDto.AdiabaticRemoval.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.AdiabaticRemoval)
        //                    {
        //                        var record = new R绝热去除记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductName, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire);
        //                        record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _adiabaticRemovalRepository.InsertAsync(record);
        //                    }
        //                }
        //                //R箭体称重时多装少装产品记录表
        //                if (workStepDto.ArrowScalageProducts != null && workStepDto.ArrowScalageProducts.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.ArrowScalageProducts)
        //                    {
        //                        var record = new R箭体称重时多装少装产品记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.RecordRemark);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.FirstConfirmResult);

        //                        await _arrowScalageProductsRepository.InsertAsync(record);
        //                    }
        //                }
        //                //舱口盖开闭测试记录表
        //                if (workStepDto.HatchOpenShutTest != null && workStepDto.HatchOpenShutTest.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.HatchOpenShutTest)
        //                    {
        //                        var record = new R舱口盖开闭测试记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductName, item.FirstDrawingName, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.Remarks);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _hatchOpenShutTestRepository.InsertAsync(record);
        //                    }
        //                }
        //                //产品接地状态检查记录表 有温湿度
        //                if (workStepDto.ProductGroundingStatus != null && workStepDto.ProductGroundingStatus.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.ProductGroundingStatus)
        //                    {
        //                        var record = new R产品接地状态检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.ProductNum, item.ToolUsed, item.RecordRemark);

        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.FirstConfirmResult);
        //                        record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _productGroundingStatusRepository.InsertAsync(record);
        //                    }
        //                }
        //                //强制检验点记录表  有5检 多媒体
        //                if (workStepDto.ForcedCheckpoint != null && workStepDto.ForcedCheckpoint.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.ForcedCheckpoint)
        //                    {
        //                        var record = new R强制检验点记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.FirstConfirmResult);
        //                        record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData), item.FourthOperator, Convert.ToDateTime(item.FourthOperatorData), item.FifthOperator, Convert.ToDateTime(item.FifthOperatorData));
        //                        await _forcedCheckpointRepository.InsertAsync(record);
        //                    }
        //                }
        //                //自动关闭口盖检查记录表
        //                if (workStepDto.AutomaticShutoff != null && workStepDto.AutomaticShutoff.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.AutomaticShutoff)
        //                    {
        //                        var record = new R自动关闭口盖检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.RecordItem, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _automaticShutoffRepository.InsertAsync(record);
        //                    }
        //                }
        //                //状态检查表
        //                if (workStepDto.StatusCheck != null && workStepDto.StatusCheck.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.StatusCheck)
        //                    {
        //                        var record = new R状态检查表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData));
        //                        await _statusCheckRepository.InsertAsync(record);
        //                    }
        //                }
        //                //问题记录表
        //                if (workStepDto.ProblemRecord != null && workStepDto.ProblemRecord.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.ProblemRecord)
        //                    {
        //                        var record = new R问题记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FirstDrawingName, item.RecordElement, item.AbnormalRecord, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.Remarks);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.MeasuredActual);
        //                        record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
        //                        await _problemRecordRepository.InsertAsync(record);
        //                    }
        //                }
        //                //爆索尺寸测量记录表 _detonatingCableSizeRepository
        //                if (workStepDto.DetonatingCableSize != null && workStepDto.DetonatingCableSize.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.DetonatingCableSize)
        //                    {
        //                        var record = new R爆索尺寸测量记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ToolUsed, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.ThirdMeasuredValues);
        //                        record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
        //                        await _detonatingCableSizeRepository.InsertAsync(record);
        //                    }
        //                }
        //                //整流罩星箭分离弹簧压缩数据记录表
        //                if (workStepDto.ReleaseSpringCompression != null && workStepDto.ReleaseSpringCompression.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.ReleaseSpringCompression)
        //                    {
        //                        var record = new R整流罩星箭分离弹簧压缩数据记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductName, item.ProductNum, item.ToolUsed, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.ThirdMeasuredValues, item.FourthMeasuredValues);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _releaseSpringCompressionRepository.InsertAsync(record);
        //                    }
        //                }
        //                //载荷支架组合体形位数据记录表
        //                if (workStepDto.LoadBracket != null && workStepDto.LoadBracket.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.LoadBracket)
        //                    {
        //                        var record = new R载荷支架组合体形位数据记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordItem, item.ToolUsed, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _loadBracketRepository.InsertAsync(record);
        //                    }
        //                }
        //                //设计签署总装数据记录表
        //                if (workStepDto.DesignGeneralAssemble != null && workStepDto.DesignGeneralAssemble.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.DesignGeneralAssemble)
        //                    {
        //                        var record = new R设计签署总装数据记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FirstDrawingName, item.RecordElement, item.ToolUsed, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand, item.ProcessorDemand, item.Remarks);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
        //                        record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData), item.FourthOperator, Convert.ToDateTime(item.FourthOperatorData));
        //                        await _designGeneralAssembleRepository.InsertAsync(record);
        //                    }
        //                }
        //                //管路活门气密点检查记录表皂泡法
        //                if (workStepDto.SoapBubble != null && workStepDto.SoapBubble.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.SoapBubble)
        //                    {
        //                        var record = new R管路活门气密点检查记录表皂泡法(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductNum, item.FisrtDrawingNum, item.SecondDrawingNum, item.RecordElement, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire, item.DesignerDemand, item.ProcessorDemand, item.Remarks);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);

        //                        await _soapBubbleRepository.InsertAsync(record);
        //                    }
        //                }
        //                //管路活门气密点检查记录表氦质谱法
        //                if (workStepDto.HeliumMassSpectrometry != null && workStepDto.HeliumMassSpectrometry.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.HeliumMassSpectrometry)
        //                    {
        //                        var record = new R管路活门气密点检查记录表氦质谱法(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductNum, item.FisrtDrawingNum, item.SecondDrawingNum, item.RecordElement, item.ToolUsed, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire, item.DesignerDemand, item.ProcessorDemand, item.Remarks);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.ThirdMeasuredValues, item.FourthMeasuredValues);
        //                        record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity, item.AtmPressure);
        //                        await _heliumMassSpectrometryRepository.InsertAsync(record);
        //                    }
        //                }
        //                //除了打保险防松外的总装直属件记录表
        //                if (workStepDto.FinalAssemblyParts != null && workStepDto.FinalAssemblyParts.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.FinalAssemblyParts)
        //                    {
        //                        var record = new R除了打保险防松外的总装直属件记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductName, item.FisrtDrawingNum, item.SecondDrawingNum,item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordMainopoint, item.DesignerDemand);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.MeasuredActual);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _finalAssemblyPartsRepository.InsertAsync(record);
        //                    }
        //                }
        //                //传感器安装测试记录情况统计记录表
        //                if (workStepDto.SensorInstallation != null && workStepDto.SensorInstallation.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.SensorInstallation)
        //                    {
        //                        var record = new R传感器安装测试记录情况统计记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductNum, item.ParentProductName, item.FisrtDrawingNum, item.FirstDrawingName, item.RecordElement, item.RecordItem, item.ToolUsed, item.SecondToolUsed, item.ThirdToolUsed, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordStatus, item.RecordRequire, item.RecordMainopoint, item.DesignerDemand, item.ProcessorDemand);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues);
        //                        record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _sensorInstallationRepository.InsertAsync(record);
        //                    }
        //                }
        //                //插头状态检查表
        //                if (workStepDto.PlugStatus != null && workStepDto.PlugStatus.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.PlugStatus)
        //                    {
        //                        var record = new R插头状态检查表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordStatus, item.RecordRequire, item.Remarks);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
        //                        record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _plugStatusRepository.InsertAsync(record);
        //                    }
        //                }
        //                //惯组安装记录表1
        //                if (workStepDto.FirstIMUInstallation != null && workStepDto.FirstIMUInstallation.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.FirstIMUInstallation)
        //                    {
        //                        var record = new R惯组安装记录表一(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ToolUsed, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _firstIMUInstallationRepository.InsertAsync(record);
        //                    }
        //                }
        //                //惯组安装记录表2
        //                if (workStepDto.SecondIMUInstallation != null && workStepDto.SecondIMUInstallation.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.SecondIMUInstallation)
        //                    {
        //                        var record = new R惯组安装记录表二(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ToolUsed, item.RecordItem, item.RecordRemark);

        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _secondIMUInstallationRepository.InsertAsync(record);
        //                    }
        //                }
        //                //电缆高度测量记录表
        //                if (workStepDto.CableHeight != null && workStepDto.CableHeight.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.CableHeight)
        //                    {
        //                        var record = new R电缆高度测量记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ToolUsed, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _cableHeightRepository.InsertAsync(record);
        //                    }
        //                }
        //                //电缆剥线试验记录表低频
        //                if (workStepDto.LowFrequencyCableStripping != null && workStepDto.LowFrequencyCableStripping.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.LowFrequencyCableStripping)
        //                    {
        //                        var record = new R电缆剥线试验记录表低频(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ToolUsed, item.SecondToolUsed, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.FirstConfirmResult);
        //                        record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _lowFrequencyCableStrippingRepository.InsertAsync(record);
        //                    }
        //                }
        //                //压接实验测量记录表低频
        //                if (workStepDto.LowCrimpingExperiment != null && workStepDto.LowCrimpingExperiment.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.LowCrimpingExperiment)
        //                    {
        //                        var record = new R压接实验测量记录表低频(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ToolUsed, item.RecordItem, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);

        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _lowCrimpingExperimentRepository.InsertAsync(record);
        //                    }
        //                }
        //                //电缆剥线试验记录表高频
        //                if (workStepDto.HighFrequencyCableStripping != null && workStepDto.HighFrequencyCableStripping.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.HighFrequencyCableStripping)
        //                    {
        //                        var record = new R电缆剥线试验记录表高频(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ToolUsed, item.SecondToolUsed, item.RecordItem, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.SecondMeasuredValues, item.FirstConfirmResult);
        //                        record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData));
        //                        await _highFrequencyCableStrippingRepository.InsertAsync(record);
        //                    }
        //                }
        //                //仪器接收检查记录表
        //                if (workStepDto.InstrumentCheck != null && workStepDto.InstrumentCheck.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.InstrumentCheck)
        //                    {
        //                        var record = new R仪器接收检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.FirstConfirmResult,item.SecondConfirmResult,item.ThirdConfirmResult);

        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));

        //                        await _instrumentCheckRepository.InsertAsync(record);
        //                    }
        //                }
        //                //电缆接收检查记录表
        //                if (workStepDto.CableReceivingInspection != null && workStepDto.CableReceivingInspection.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.CableReceivingInspection)
        //                    {
        //                        var record = new R电缆接收检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(),item.FirstConfirmResult, item.SecondConfirmResult, item.ThirdConfirmResult);

        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));

        //                        await _cableReceivingInspectionRepository.InsertAsync(record);
        //                    }
        //                }
        //                //通用检查记录表
        //                if (workStepDto.InspectionRecord != null && workStepDto.InspectionRecord.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.InspectionRecord)
        //                    {
        //                        var record = new R通用检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductName,item.RecordItem, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);

        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));

        //                        await _inspectionRecordRepository.InsertAsync(record);
        //                    }
        //                }
        //                //对接面形位记录表
        //                if (workStepDto.DockSurfaceMorpheme != null && workStepDto.DockSurfaceMorpheme.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.DockSurfaceMorpheme)
        //                    {
        //                        var record = new R对接面形位记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductName, item.ParentProductName,item.ToolUsed, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);

        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
        //                        await _dockSurfaceMorphemeRepository.InsertAsync(record);
        //                    }
        //                }
        //                //整流罩锉修记录表
        //                if (workStepDto.FilingFileRepair != null && workStepDto.FilingFileRepair.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.FilingFileRepair)
        //                    {
        //                        var record = new R整流罩锉修记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);

        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.MeasuredActual);

        //                        await _filingFileRepairRepository.InsertAsync(record);
        //                    }
        //                }
        //                //整流罩安装后检查记录表
        //                if (workStepDto.CheckFairingAfterInstallation != null && workStepDto.CheckFairingAfterInstallation.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.CheckFairingAfterInstallation)
        //                    {
        //                        var record = new R整流罩安装后检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FirstDrawingName, item.RecordRemark);

        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(),item.MeasuredActual, item.FirstConfirmResult);

        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));

        //                        await _checkFairingAfterInstallationRepository.InsertAsync(record);
        //                    }
        //                }
        //                //导管检查记录表
        //                if (workStepDto.Catheterization != null && workStepDto.Catheterization.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.Catheterization)
        //                    {
        //                        var record = new R导管检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);

        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.MeasuredActual);
        //                        record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData), item.FourthOperator, Convert.ToDateTime(item.FourthOperatorData));
        //                        await _catheterizationRepository.InsertAsync(record);
        //                    }
        //                }
        //                //管路上箭前吹除记录表
        //                if (workStepDto.BlowPipeArrow != null && workStepDto.BlowPipeArrow.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.BlowPipeArrow)
        //                    {
        //                        var record = new R管路上箭前吹除记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);

        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues,item.SecondMeasuredValues,item.FirstConfirmResult);
        //                        record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _blowPipeArrowRepository.InsertAsync(record);
        //                    }
        //                }
        //                //气封管流量测试记录表
        //                if (workStepDto.GasPipeTest != null && workStepDto.GasPipeTest.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.GasPipeTest)
        //                    {
        //                        var record = new R气封管流量测试记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ToolUsed, item.FisrtDrawingNum, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.ProcessorDemand,item.RecordRequire);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues,item.SecondMeasuredValues,item.ThirdMeasuredValues,item.FourthMeasuredValues);
        //                        record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _gasPipeTestRepository.InsertAsync(record);
        //                    }
        //                }
        //                //阀门气瓶过滤器流量计输送管金属软管等检查记录表
        //                if (workStepDto.ValvesGasInspection != null && workStepDto.ValvesGasInspection.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.ValvesGasInspection)
        //                    {
        //                        var record = new R阀门气瓶过滤器流量计输送管金属软管等检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName,item.ProductNum,item.RecordElement, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordStatus);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
        //                        record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _valvesGasInspectionRepository.InsertAsync(record);
        //                    }
        //                }
        //                //单机安装位置记录表
        //                if (workStepDto.InstallationLocation != null && workStepDto.InstallationLocation.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.InstallationLocation)
        //                    {
        //                        var record = new R单机安装位置记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ProductNum, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);

        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _installationLocationRepository.InsertAsync(record);
        //                    }
        //                }
        //                //安装距离记录表
        //                if (workStepDto.InstallationDistance != null && workStepDto.InstallationDistance.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.InstallationDistance)
        //                    {
        //                        var record = new R安装距离记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordElement, item.ToolUsed, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation,item.RecordRequire);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);

        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _installationDistanceRepository.InsertAsync(record);
        //                    }
        //                }
        //                //小导管卡箍间距测量表
        //                if (workStepDto.MeasurementSpacingConduit != null && workStepDto.MeasurementSpacingConduit.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.MeasurementSpacingConduit)
        //                    {
        //                        var record = new R小导管卡箍间距测量表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ToolUsed, item.FisrtDrawingNum, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordMainopoint);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
        //                        record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _measurementSpacingConduitRepository.InsertAsync(record);
        //                    }
        //                }
        //                //未按要求施加力矩及未打保险防松记录表
        //                if (workStepDto.FailureAequiredLoosInsurance != null && workStepDto.FailureAequiredLoosInsurance.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.FailureAequiredLoosInsurance)
        //                    {
        //                        var record = new R未按要求施加力矩及未打保险防松记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation,item.RecordMainopoint,item.ProcessorDemand);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues,item.MeasuredActual);

        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _failureAequiredLoosInsuranceRepository.InsertAsync(record);
        //                    }
        //                }
        //                //分解重装记录表
        //                if (workStepDto.DisassemblyReassembly != null && workStepDto.DisassemblyReassembly.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.DisassemblyReassembly)
        //                    {
        //                        var record = new R分解重装记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(),  item.RecordMainopoint, item.RecordRequire);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(),  item.MeasuredActual);

        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _disassemblyReassemblyRepository.InsertAsync(record);
        //                    }
        //                }
        //                //配合七零三绝热记录表
        //                if (workStepDto.Insulation703 != null && workStepDto.Insulation703.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.Insulation703)
        //                    {
        //                        var record = new R配合七零三绝热记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FirstDrawingName,item.ParentProductName, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordMainopoint);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);

        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _insulation703Repository.InsertAsync(record);
        //                    }
        //                }
        //                //连续拧紧环节力矩复校记录表
        //                if (workStepDto.CalibrationContinuousTorque != null && workStepDto.CalibrationContinuousTorque.Count > 0)
        //                {
        //                    foreach (var item in workStepDto.CalibrationContinuousTorque)
        //                    {
        //                        var record = new R连续拧紧环节力矩复校记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.SecondDrawingNum,item.ToolUsed, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation,item.DesignerDemand,item.ProcessorDemand);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues,item.SecondMeasuredValues);

        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _calibrationContinuousTorqueRepository.InsertAsync(record);
        //                    }
        //                }
        //                //管路垫块安装情况记录表
        //                if (workStepDto.InstallationPipeCushion != null && workStepDto.InstallationPipeCushion.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.InstallationPipeCushion)
        //                    {
        //                        var record = new R管路垫块安装情况记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordMainopoint);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.MeasuredActual);

        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _installationPipeCushionRepository.InsertAsync(record);
        //                    }
        //                }
        //                //箭体结构防水记录表
        //                if (workStepDto.ArrowStructureWaterproof != null && workStepDto.ArrowStructureWaterproof.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.ArrowStructureWaterproof)
        //                    {
        //                        var record = new R箭体结构防水记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum,item.ParentProductName,item.RecordElement, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand, item.Remarks);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);

        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _arrowStructureWaterproofRepository.InsertAsync(record);
        //                    }
        //                }
        //                //搭接线安装部位防水记录表
        //                if (workStepDto.WaterproofInstallationLapd != null && workStepDto.WaterproofInstallationLapd.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.WaterproofInstallationLapd)
        //                    {
        //                        var record = new R搭接线安装部位防水记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort,  item.ParentProductName, item.RecordElement, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand, item.Remarks);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(),item.FirstMeasuredValues, item.FirstConfirmResult);

        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _waterproofInstallationLapdRepository.InsertAsync(record);
        //                    }
        //                }
        //                //总装零件称重记录表
        //                if (workStepDto.Assemnleweighing != null && workStepDto.Assemnleweighing.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.Assemnleweighing)
        //                    {
        //                        var record = new R总装零件称重记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName,item.ToolUsed, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues);

        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _assemnleweighingRepository.InsertAsync(record);
        //                    }
        //                }
        //                //箭体称重记录表 ArrowWeight
        //                if (workStepDto.ArrowWeight != null && workStepDto.ArrowWeight.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.ArrowWeight)
        //                    {
        //                        var record = new R箭体称重记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ParentProductName, item.RecordElement, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire,item.RecordStatus);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
        //                        record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _arrowWeightRepository.InsertAsync(record);
        //                    }
        //                }
        //                //总装耗材称重记录表
        //                if (workStepDto.GeneralWeighing != null && workStepDto.GeneralWeighing.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.GeneralWeighing)
        //                    {
        //                        var record = new R总装耗材称重记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.FirstDrawingName, item.ToolUsed, item.RecordRemark);

        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues,item.ThirdMeasuredValues,item.FourthMeasuredValues);

        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _generalWeighingRepository.InsertAsync(record);
        //                    }
        //                }
        //                //飞行质量质心设备调平数据记录表
        //                if (workStepDto.LevelingDataFlight != null && workStepDto.LevelingDataFlight.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.LevelingDataFlight)
        //                    {
        //                        var record = new R飞行质量质心设备调平数据记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);


        //                        await _levelingDataFlightRepository.InsertAsync(record);
        //                    }
        //                }
        //                //飞行质量质心皮重及参数记录表
        //                if (workStepDto.FlightMassCentroidTareWeight != null && workStepDto.FlightMassCentroidTareWeight.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.FlightMassCentroidTareWeight)
        //                    {
        //                        var record = new R飞行质量质心皮重及参数记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement,item.RecordItem, item.RecordRemark);

        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);


        //                        await _flightMassCentroidTareWeightRepository.InsertAsync(record);
        //                    }
        //                }
        //                //横向质心测量记录表
        //                if (workStepDto.TransverseCentroid != null && workStepDto.TransverseCentroid.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.TransverseCentroid)
        //                    {
        //                        var record = new R横向质心测量记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues,item.SecondMeasuredValues,item.ThirdMeasuredValues,item.FourthMeasuredValues);


        //                        await _transverseCentroidRepository.InsertAsync(record);
        //                    }
        //                }
        //                //大部段称重记录表
        //                if (workStepDto.LargeSectionWeight != null && workStepDto.LargeSectionWeight.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.LargeSectionWeight)
        //                    {
        //                        var record = new R大部段称重记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort,item.ToolUsed, item.RecordElement, item.RecordRemark);

        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
        //                        record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);

        //                        await _largeSectionWeightRepository.InsertAsync(record);
        //                    }
        //                }
        //                // 产品安装确认表
        //                if (workStepDto.ProductInstallationConfirmation != null && workStepDto.ProductInstallationConfirmation.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.ProductInstallationConfirmation)
        //                    {
        //                        var record = new R产品安装确认表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.ProcessorDemand,item.Remarks);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.MeasuredActual);


        //                        await _productInstallationConfirmationRepository.InsertAsync(record);
        //                    }
        //                }
        //                //阀门安装状态确认表
        //                if (workStepDto.ConfirmationStatus != null && workStepDto.ConfirmationStatus.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.ConfirmationStatus)
        //                    {
        //                        var record = new R阀门安装状态确认表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement,item.FisrtDrawingNum,item.FirstDrawingName,item.ProductNum, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.Remarks);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);


        //                        await _confirmationStatusRepository.InsertAsync(record);
        //                    }
        //                }
        //                //接收检查记录表
        //                if (workStepDto.ReceivingInspectionRecord != null && workStepDto.ReceivingInspectionRecord.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.ReceivingInspectionRecord)
        //                    {
        //                        var record = new R通用接收检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire);
        //                        record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.MeasuredActual);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));

        //                        await _receivingInspectionRecordRepository.InsertAsync(record);
        //                    }
        //                }
        //                //通用保护件检查记录表
        //                if (workStepDto.ProtectiveParts != null && workStepDto.ProtectiveParts.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.ProtectiveParts)
        //                    {
        //                        var record = new R通用保护件检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FirstDrawingName, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordStatus, item.RecordRequire);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(),item.FirstConfirmResult, item.MeasuredActual);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));

        //                        await _protectivePartsRepository.InsertAsync(record);
        //                    }
        //                }
        //                //接口检查记录表
        //                if (workStepDto.InterfaceCheck != null && workStepDto.InterfaceCheck.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.InterfaceCheck)
        //                    {
        //                        var record = new R接口检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult, item.MeasuredActual);
        //                        record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));

        //                        await _interfaceCheckRepository.InsertAsync(record);
        //                    }
        //                }
        //                //象限标识检查记录表
        //                if (workStepDto.QuadrantCheck != null && workStepDto.QuadrantCheck.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.QuadrantCheck)
        //                    {
        //                        var record = new R象限标识检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordRequire, item.Remarks);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.FirstConfirmResult);
        //                        await _quadrantCheckRepository.InsertAsync(record);
        //                    }
        //                }
        //                //干燥剂检查记录表
        //                if (workStepDto.DesiccantInspection != null && workStepDto.DesiccantInspection.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.DesiccantInspection)
        //                    {
        //                        var record = new R干燥剂检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.Remarks);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(),  item.MeasuredActual);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _desiccantInspectionRepository.InsertAsync(record);
        //                    }
        //                }
        //                //随大部段交付产品明细表
        //                if (workStepDto.LargePartsDelivery != null && workStepDto.LargePartsDelivery.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.LargePartsDelivery)
        //                    {
        //                        var record = new R随大部段交付产品明细表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum,item.FirstDrawingName, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(),item.DesignerDemand,item.Remarks);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);

        //                        await _largePartsDeliveryRepository.InsertAsync(record);
        //                    }
        //                }
        //                //气瓶组充放气速率记录表
        //                if (workStepDto.CylinderGroup != null && workStepDto.CylinderGroup.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.CylinderGroup)
        //                    {
        //                        var record = new R气瓶组充放气速率记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ToolUsed, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues,item.SecondMeasuredValues,item.ThirdMeasuredValues,item.FourthMeasuredValues);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _cylinderGroupRepository.InsertAsync(record);
        //                    }
        //                }
        //                //系统保压记录表
        //                if (workStepDto.SystemPressureMaintaining != null && workStepDto.SystemPressureMaintaining.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.SystemPressureMaintaining)
        //                    {
        //                        var record = new R系统保压记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FirstDrawingName,item.ToolUsed, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordStatus,item.DesignerDemand,item.RecordRequire);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues);
        //                        record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
        //                        await _systemPressureMaintainingRepository.InsertAsync(record);
        //                    }
        //                }
        //                //气瓶压力测试记录表
        //                if (workStepDto.CylinderPressureTest != null && workStepDto.CylinderPressureTest.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.CylinderPressureTest)
        //                    {
        //                        var record = new R气瓶压力测试记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FirstDrawingName, item.ToolUsed, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand, item.Remarks);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);

        //                        await _cylinderPressureTestRepository.InsertAsync(record);
        //                    }
        //                }
        //                //阀门使用次数记录表
        //                if (workStepDto.ValveUsageTimes != null && workStepDto.ValveUsageTimes.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.ValveUsageTimes)
        //                    {
        //                        var record = new R阀门使用次数记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum,item.ProductNum, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand,item.RecordStatus);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _valveUsageTimesRepository.InsertAsync(record);
        //                    }
        //                }
        //                //阀门测试记录表
        //                if (workStepDto.ValveTest != null && workStepDto.ValveTest.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.ValveTest)
        //                    {
        //                        var record = new R阀门测试记录表一(item.SerialNum, workStep.Id, proDto.Id, item.Sort,  item.FisrtDrawingNum, item.ProductNum, item.FirstDrawingName, item.RecordElement, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire, item.RecordStatus,item.Remarks);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
        //                        record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _valveTestRepository.InsertAsync(record);
        //                    }
        //                }
        //                //气封流量测试记录表
        //                if (workStepDto.GasSealFlowTest != null && workStepDto.GasSealFlowTest.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.GasSealFlowTest)
        //                    {
        //                        var record = new R气封流量测试记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort,  item.FirstDrawingName, item.ToolUsed, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues,item.ThirdMeasuredValues);
        //                        record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _gasSealFlowTestRepository.InsertAsync(record);
        //                    }
        //                }
        //                //阀门测试记录表2
        //                if (workStepDto.ValveTestSec != null && workStepDto.ValveTestSec.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.ValveTestSec)
        //                    {
        //                        var record = new R阀门测试记录表二(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum,item.ProductNum, item.FirstDrawingName, item.RecordElement, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire, item.RecordStatus, item.Remarks);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues);
        //                        record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _valveTestSecRepository.InsertAsync(record);
        //                    }
        //                }
        //                //电磁阀尾罩检查表
        //                if (workStepDto.TailCoverSolenoid != null && workStepDto.TailCoverSolenoid.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.TailCoverSolenoid)
        //                    {
        //                        var record = new R电磁阀尾罩检查表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordRequire, item.Remarks);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _tailCoverSolenoidRepository.InsertAsync(record);
        //                    }
        //                }
        //                //传感器变换器对应关系确认记录表
        //                if (workStepDto.CorrespondingRelationship != null && workStepDto.CorrespondingRelationship.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.CorrespondingRelationship)
        //                    {
        //                        var record = new R传感器变换器对应关系确认记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum,item.ParentProductNum,item.ParentProductName,item.SecondDrawingNum, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordRequire, item.RecordStatus,item.RecordMainopoint);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstConfirmResult);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _correspondingRelationshipRepository.InsertAsync(record);
        //                    }
        //                }
        //                //产品安装数量记录表
        //                if (workStepDto.InstallationQuantity != null && workStepDto.InstallationQuantity.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.InstallationQuantity)
        //                    {
        //                        var record = new R产品安装数量记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement, item.RecordRemark);

        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _installationQuantityRepository.InsertAsync(record);
        //                    }
        //                }
        //                //液位传感器尺寸协调记录表
        //                if (workStepDto.LiquidLevelSensor != null && workStepDto.LiquidLevelSensor.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.LiquidLevelSensor)
        //                    {
        //                        var record = new R液位传感器尺寸协调记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordElement,item.ToolUsed, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.DesignerDemand);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues,item.SecondMeasuredValues);
        //                        record.Environment = record.SetEnvironment(new REnvironmentEntity(), item.Temperature, item.Humidity);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _liquidLevelSensorRepository.InsertAsync(record);
        //                    }
        //                }
        //                //密封插头压接多媒体记录表
        //                if (workStepDto.CrimpingSealedPlug != null && workStepDto.CrimpingSealedPlug.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.CrimpingSealedPlug)
        //                    {
        //                        var record = new R密封插头压接多媒体记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.FisrtDrawingNum, item.ParentProductNum, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation,item.RecordMainopoint,item.Remarks);
        //                        record.MultiMedia = record.SetMultiMedia(new RMultiMediaEntity(), item.PhotoNo);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData), item.FourthOperator, Convert.ToDateTime(item.FourthOperatorData));
        //                        await _crimpingSealedPlugRepository.InsertAsync(record);
        //                    }
        //                }
        //                //岗位分工表
        //                if (workStepDto.JobDivision != null && workStepDto.JobDivision.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.JobDivision)
        //                    {
        //                        var record = new R岗位分工表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.RecordRemark);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues,item.MeasuredActual);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData), item.FourthOperator, Convert.ToDateTime(item.FourthOperatorData));
        //                        await _jobDivisionRepository.InsertAsync(record);
        //                    }
        //                }
        //                //低频压接实验测量记录表
        //                if (workStepDto.ExperimentalCrimping != null && workStepDto.ExperimentalCrimping.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.ExperimentalCrimping)
        //                    {
        //                        var record = new R低频压接实验测量记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort,item.ToolUsed,item.SecondToolUsed,item.ThirdToolUsed,item.RecordItem, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordRequire, item.RecordStatus, item.RecordMainopoint);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues,item.ThirdMeasuredValues);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _experimentalCrimpingRepository.InsertAsync(record);
        //                    }
        //                }
        //                //高频压接点电阻及抗电强度检查记录表
        //                if (workStepDto.HighFrequencyVoltage != null && workStepDto.HighFrequencyVoltage.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.HighFrequencyVoltage)
        //                    {
        //                        var record = new R高频压接点电阻及抗电强度检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ToolUsed, item.SecondToolUsed, item.ThirdToolUsed, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordLocation, item.RecordRequire, item.RecordStatus, item.RecordMainopoint);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues, item.ThirdMeasuredValues);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _highFrequencyVoltageRepository.InsertAsync(record);
        //                    }
        //                }
        //                //高频压接点抗拉强度检查记录表
        //                if (workStepDto.TensileStrengthHigh != null && workStepDto.TensileStrengthHigh.Count > 0)

        //                {
        //                    foreach (var item in workStepDto.TensileStrengthHigh)
        //                    {
        //                        var record = new R高频压接点抗拉强度检查记录表(item.SerialNum, workStep.Id, proDto.Id, item.Sort, item.ToolUsed, item.RecordRemark);
        //                        record.RecordRequirements = record.SetRecordRequirements(new RRecordRequirementsEntity(), item.RecordRequire, item.RecordStatus);
        //                        record.MeasuredResult = record.SetMeasuredResult(new RMeasuredResultEntity(), item.FirstMeasuredValues, item.SecondMeasuredValues);
        //                        record.InspectionSignature = record.SetInspectionSignature(new RInspectionSignatureEntity(), item.FirstOperator, Convert.ToDateTime(item.FirstOperatorData), item.SecondOperator, Convert.ToDateTime(item.SecondOperatorData), item.ThirdOperator, Convert.ToDateTime(item.ThirdOperatorData));
        //                        await _tensileStrengthHighRepository.InsertAsync(record);
        //                    }
        //                }
        //            }
        //            catch(Exception e)
        //            {
        //                throw e;// new UserFriendlyException("文件未签署完成！");
        //            }
        //        }
        //    }
        //    var Id = await _rTechniqueRepository.InsertAndGetIdAsync(technique);
        //    return Id;
        //}

        //private DateTime? GetDateTime(string time)
        //{
        //    if (string.IsNullOrEmpty(time))
        //    {
        //        return null;
        //    }
        //    else
        //    {
        //        return Convert.ToDateTime(time);
        //    }
        //}
    }
}
